[英]Jooq postgre insert error with play2.5 scala
I'm using jooq in an app with play2.5 and scala 我在带有play2.5和scala的应用程序中使用jooq
When I'm inserting a simple query the driver prepares a query with ` around table and field names and postgres responds with an error, how can I overcome this, there is probably a driver parameter to set this behavior? 当我插入一个简单的查询时,驱动程序会在表和字段名称周围准备带有`的查询,而postgres会返回错误,我该如何克服呢,可能有一个驱动程序参数来设置此行为?
I'm using 我正在使用
the sbt config sbt配置
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
evolutions,
filters,
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.0-RC1" % Test,
"org.postgresql" % "postgresql" % "9.2-1003-jdbc4",
"org.jooq" % "jooq" % "3.7.0",
"org.jooq" % "jooq-codegen-maven" % "3.7.0",
"org.jooq" % "jooq-meta" % "3.7.0",
"joda-time" % "joda-time" % "2.7",
"com.adrianhurt" %% "play-bootstrap" % "1.1-P25-B3",
"org.mindrot" % "jbcrypt" % "0.3m"
)
the error: 错误:
[debug] 2017-03-12 11:18:52,042 o.j.t.LoggerListener - Executing query : insert into `public`.`user_account` (`nickname`, `email`, `password`, `role`) values (?, ?, ?, ?)
[debug] 2017-03-12 11:18:52,043 o.j.t.LoggerListener - -> with bind values : insert into `public`.`user_account` (`nickname`, `email`, `password`, `role`) values ('', 'simon.cigoj@gmail.com', 'nomis05', 'ROLE_USER')
[error] 2017-03-12 11:18:52,139 o.j.StatementLogger - insert into `public`.`user_account` (`nickname`, `email`, `password`, `role`) values ('', 'aaa@mail.com', 'kjhkh', 'ROLE_USER');
throws exception: org.postgresql.util.PSQLException: ERROR: syntax error at or near "`"
Position: 13
org.postgresql.util.PSQLException: ERROR: syntax error at or near "`"
Position: 13
It looks like you did not set the correct SQLDialect
, like 看来您未设置正确的SQLDialect
,例如
SQLDialect.POSTGRES_9_5
https://www.jooq.org/javadoc/3.8.x/org/jooq/SQLDialect.html https://www.jooq.org/javadoc/3.8.x/org/jooq/SQLDialect.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.