gpt4 book ai didi

java - @SqlQuery 抛出 org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException : java. sql.SQLException:SQL Anywhere 错误 -131

转载 作者:行者123 更新时间:2023-12-01 18:07:14 30 4
gpt4 key购买 nike

当我执行时:

  @SqlQuery("select A.field1, A.field2, C.field3, C.field4, C.field5 from "
+ "table1 A, table2 B, table3 C WHERE A.field2 >= '1500' AND A.field2 < '9500' "
+ "AND A.field1 NOT IN (SELECT field1 FROM table4) AND A.field1 = B.field1 AND "
+ "(B.field3 = 'NAME' OR B.field3 ='STRT') order by A.field1 ASC")

我不断收到以下错误:

problem parsing template 'c2VsZWN0IEEuVVBDX05VTSwgQS5NT0RVTEVfTlVNLCBDLkNIUl9OTSwgQy5DSFJfQ0QsIEMuVkwgZnJvbSBVUEMgQSwgVVBDX0NIUiBCLCBDSFJfVkwgQyBXSEVSRSBBLk1PRFVMRV9OVU0gPj0gJzEwMDAnIEFORCBBLk1PRFVMRV9OVU0gPCAnOTAwMCcgQU5EIEEuVVBDX05VTSBOT1QgSU4gKFNFTEVDVCBVUENfTlVNIEZST00gVVBDX0FDVFYpIEFORCBBLlVQQ19OVU0gPSBCLlVQQ19OVU0gIEFORCAoQi5DSFJfTk0gPSAnQlJBTkQnIE9SIEIuQ0hSX05NID0nVFlQRScpIEFORCBCLk1PRFVMRV9OVU0gPSBDLk1PRFVMRV9OVU0gIEFORCBCLkNIUl9OTSA9IEMuQ0hSX05NICBBTkQgQi5DSFJfQ0QgPSBDLkNIUl9DRCBvcmRlciBieSBBLlVQQ19OVU0gQVND'
line 1:373: expecting '>', found '<EOF>'
at org.antlr.stringtemplate.language.AngleBracketTemplateLexer.nextToken(AngleBracketTemplateLexer.java:149)
at antlr.TokenBuffer.fill(TokenBuffer.java:69)
at antlr.TokenBuffer.LA(TokenBuffer.java:80)
at antlr.LLkParser.LA(LLkParser.java:52)
at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103)
at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850)
at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441)
at org.antlr.stringtemplate.StringTemplateGroup.defineTemplate(StringTemplateGroup.java:679)
at org.skife.jdbi.v2.sqlobject.stringtemplate.StringTemplate3StatementLocator.locate(StringTemplate3StatementLocator.java:260)
at org.skife.jdbi.v2.SQLStatement.wrapLookup(SQLStatement.java:1284)
at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1293)
at org.skife.jdbi.v2.Query.iterator(Query.java:240)
at org.skife.jdbi.v2.sqlobject.ResultReturnThing$IteratorResultReturnThing.result(ResultReturnThing.java:162)
at org.skife.jdbi.v2.sqlobject.ResultReturnThing.map(ResultReturnThing.java:43)
at org.skife.jdbi.v2.sqlobject.QueryHandler.invoke(QueryHandler.java:43)
at org.skife.jdbi.v2.sqlobject.SqlObject.invoke(SqlObject.java:212)
at org.skife.jdbi.v2.sqlobject.SqlObject$2.intercept(SqlObject.java:109)
at com.test.project.MyDAO$$EnhancerByCGLIB$$96e97b19.usTest(<generated>)
at com.test.project.Main.getDataDb(Main.java:300)
at com.test.project.Main.run(Main.java:130)
at com.test.project.Main.main(Main.java:83)
Exception in thread "main" org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: java.sql.SQLException: SQL Anywhere Error -131: Syntax error near '(end of line)' on line 1 [statement:"select A.field1, A.field2, C.field3, C.field4, C.field5 from table1 A, table2 B, table3 C WHERE A.field2 >= '1500' AND A.field2 < '9500' AND A.field1 NOT IN (SELECT field1 FROM table4) AND A.field1 = B.field1 AND (B.field3 = 'NAME' OR B.field3 ='STRT') order by A.field1 ASC", located:"select A.field1, A.field2, C.field3, C.field4, C.field5 from table1 A, table2 B, table3 C WHERE A.field2 >= '1500' AND A.field2 < ", arguments:{ positional:{}, named:{}, finder:[]}]
at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1337)
at org.skife.jdbi.v2.Query.iterator(Query.java:240)
at org.skife.jdbi.v2.sqlobject.ResultReturnThing$IteratorResultReturnThing.result(ResultReturnThing.java:162)
at org.skife.jdbi.v2.sqlobject.ResultReturnThing.map(ResultReturnThing.java:43)
at org.skife.jdbi.v2.sqlobject.QueryHandler.invoke(QueryHandler.java:43)
at org.skife.jdbi.v2.sqlobject.SqlObject.invoke(SqlObject.java:212)
at org.skife.jdbi.v2.sqlobject.SqlObject$2.intercept(SqlObject.java:109)
at com.test.project.MyDAO$$EnhancerByCGLIB$$96e97b19.usTest(<generated>)
at com.test.project.Main.getDataDb(Main.java:300)
at com.test.project.Main.run(Main.java:130)
at com.test.project.Main.main(Main.java:83)
Caused by: java.sql.SQLException: SQL Anywhere Error -131: Syntax error near '(end of line)' on line 1
at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.handleSQLE(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.executeLoop(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.execute(Unknown Source)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.execute(Unknown Source)
at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1326)
... 10 more

当我删除这个A.field2 < '9500'时,查询工作正常。 < 是问题的原因吗?

最佳答案

问题可能来自于:

  • 将antlr与jdbi混合使用,antlr负责对sql语句进行分块。 Jdbi 声称它可以在没有任何依赖项的情况下运行,因此不需要 antlr jar,我认为只有 jdbi 包就足够了
  • 或者它可能可能是一个错误,因为我在解析jdbi中的sql语句时发现了一些问题来解决这个问题,你可以像这样\\<

关于java - @SqlQuery 抛出 org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException : java. sql.SQLException:SQL Anywhere 错误 -131,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35410426/

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