gpt4 book ai didi

java.sql.SQLSyntaxErrorException : unexpected token: (

转载 作者:行者123 更新时间:2023-12-02 11:03:52 28 4
gpt4 key购买 nike

抱歉我的英语不好,我是法国人我需要一点帮助:-)

我有一个java.sql.SQLSyntaxErrorException但我找不到发生了什么。

这是跟踪:

org.springframework.jdbc.datasource.init.ScriptStatementFailedException:
Failed to execute SQL script statement #1 of class path resource
[ddl/ddl-table.sql]: CREATE TABLE user_klesia(noss varchar(15),email
varchar(45),tel_fixe varchar(20),tel_mobile varchar(20)
,statut_consentement varchar(20) ,consentement_offres_date timestamp
NULL,certification_date timestamp NULL,derniere_tentative_date
timestamp NULL,id_web bigint(20) NOT NULL AUTO_INCREMENT,certifie
int(1) DEFAULT '0',date_naissance date ,origine varchar(2) DEFAULT
'K',question_secrete varchar(45),reponse_secrete
varchar(45),liferay_user_id bigint(20),nom varchar(200),prenom
varchar(200),indicateur_tel_fixe varchar(20),code_pays_fixe
varchar(4),indicateur_tel_mobile varchar(20),code_pays_mobile
varchar(4),civilite varchar(15),id_indv_ur
bigint(20),blocage_compte_date timestamp NULL,nb_tentatives
int(1),id_indv_alloc bigint(20),question_certifiante varchar(200)
,reponse_certifiante varchar(200) ,mode_certification varchar(20)
,otp_certifiant varchar(10) ,email_date_maj timestamp NULL
,tel_fixe_date_maj timestamp NULL ,tel_mobile_date_maj timestamp NULL
,id_individu bigint(20),france_connect varchar(45) ,sub varchar(255)
,sso_ima int(1),PRIMARY KEY (id_web)); nested exception is
java.sql.SQLSyntaxErrorException: unexpected token: (
at org.springframework.jdbc.datasource.init.ScriptUtils.executeSqlScript(ScriptUtils.java:492)
at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:240)
at org.springframework.jdbc.datasource.init.DatabasePopulatorUtils.execute(DatabasePopulatorUtils.java:48)
at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.initDatabase(EmbeddedDatabaseFactory.java:200)
at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.getDatabase(EmbeddedDatabaseFactory.java:157)
at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder.build(EmbeddedDatabaseBuilder.java:270)
at fr.koudama.batch.excellent.test.launchJob(test.java:82)

这是我的 SQL 语句:

CREATE TABLE user_klesia(noss varchar(15),
email varchar(45),
tel_fixe varchar(20),
tel_mobile varchar(20),
statut_consentement varchar(20),
consentement_offres_date timestamp NULL,
certification_date timestamp NULL,
derniere_tentative_date timestamp NULL,
id_web bigint(20) NOT NULL AUTO_INCREMENT,
certifie int(1) DEFAULT '0',
date_naissance date,
origine varchar(2) DEFAULT 'K',
question_secrete varchar(45),
reponse_secrete varchar(45),
liferay_user_id bigint(20),
nom varchar(200),
prenom varchar(200),
indicateur_tel_fixe varchar(20),
code_pays_fixe varchar(4),
indicateur_tel_mobile varchar(20),
code_pays_mobile varchar(4),
civilite varchar(15),
id_indv_ur bigint(20),
blocage_compte_date timestamp NULL,
nb_tentatives int(1),
id_indv_alloc bigint(20),
question_certifiante varchar(200),
reponse_certifiante varchar(200),
mode_certification varchar(20),
otp_certifiant varchar(10),
email_date_maj timestamp NULL,
tel_fixe_date_maj timestamp NULL,
tel_mobile_date_maj timestamp NULL,
id_individu bigint(20),
france_connect varchar(45),
sub varchar(255),
sso_ima int(1),
PRIMARY KEY (id_web));

最佳答案

您的 DDL 有一些问题:

  • bigintint 不能有大小。您需要将 bigint(20) 更改为 bigint,将 int(1) 更改为 int
  • auto_increment 不存在,但它被实现为 identity

我修复了您的 SQL 并在 HyperSQL 2.3.4 中对其进行了测试。现在效果很好:

CREATE TABLE user_klesia (
noss varchar(15),
email varchar(45),
tel_fixe varchar(20),
tel_mobile varchar(20) ,
statut_consentement varchar(20) ,
consentement_offres_date timestamp NULL,
certification_date timestamp NULL,
derniere_tentative_date timestamp NULL,
id_web bigint identity NOT NULL,
certifie int DEFAULT '0',
date_naissance date ,
origine varchar(2) DEFAULT 'K',
question_secrete varchar(45),
reponse_secrete varchar(45),
liferay_user_id bigint,
nom varchar(200),
prenom varchar(200),
indicateur_tel_fixe varchar(20),
code_pays_fixe varchar(4),
indicateur_tel_mobile varchar(20),
code_pays_mobile varchar(4),
civilite varchar(15),
id_indv_ur bigint,
blocage_compte_date timestamp NULL,
nb_tentatives int,
id_indv_alloc bigint,
question_certifiante varchar(200) ,
reponse_certifiante varchar(200) ,
mode_certification varchar(20) ,
otp_certifiant varchar(10) ,
email_date_maj timestamp NULL ,
tel_fixe_date_maj timestamp NULL ,
tel_mobile_date_maj timestamp NULL ,
id_individu bigint,
france_connect varchar(45),
sub varchar(255),
sso_ima int,
PRIMARY KEY (id_web)
);

关于java.sql.SQLSyntaxErrorException : unexpected token: (,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51133443/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com