Java 执行查询时DB2 SQLSTATE 42601

Java 执行查询时DB2 SQLSTATE 42601,java,db2,sqlexception,Java,Db2,Sqlexception,我在文件中存储了一个sql查询。 以下是查询的开始: merge into SCHEMA.TABLE as A using ( values (599999991, '2012-12-31',...... 我有一个Java应用程序,并将查询加载到String对象中——没问题。然后,我做以下工作: private static final String DRIVER = "com.ibm.db2.jcc.DB2Driver"; ... Class.forName(

我在文件中存储了一个sql查询。 以下是查询的开始:

merge
    into SCHEMA.TABLE as A
    using (
        values (599999991, '2012-12-31',......
我有一个Java应用程序,并将查询加载到String对象中——没问题。然后,我做以下工作:

private static final String DRIVER = "com.ibm.db2.jcc.DB2Driver";
...
Class.forName(DRIVER);
...
Connection connection = DriverManager.getConnection(location, user, password);
preparedStatement = connection.prepareStatement(queryString);
return preparedStatement.executeUpdate();
queryString已正确加载。 preparedStatement也应该可以-我在查询中没有任何参数。 但我有一个例外:

com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601,   SQLERRMC: into SCHEMA.TABLE as A    using (        values (599;merge    ;<space>
at com.ibm.db2.jcc.c.tf.e(tf.java:1680)
at com.ibm.db2.jcc.c.tf.a(tf.java:1239)
at com.ibm.db2.jcc.b.jb.h(jb.java:139)
at com.ibm.db2.jcc.b.jb.a(jb.java:43)
at com.ibm.db2.jcc.b.w.a(w.java:30)
at com.ibm.db2.jcc.b.cc.f(cc.java:161)
at com.ibm.db2.jcc.c.tf.n(tf.java:1219)
at com.ibm.db2.jcc.c.uf.gb(uf.java:1816)
at com.ibm.db2.jcc.c.uf.d(uf.java:2298)
at com.ibm.db2.jcc.c.uf.Y(uf.java:540)
at com.ibm.db2.jcc.c.uf.executeUpdate(uf.java:523)
at com.epam.sbrf.db.DBUtil.executeUpdateQuery(DBUtil.java:93)
at com.epam.sbrf.db.DBUtil.executeUpdateQuery(DBUtil.java:77)
at com.epam.sbrf.test.AggregateTest.BeforeTest(AggregateTest.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.TestRunner.beforeRun(TestRunner.java:641)
at org.testng.TestRunner.run(TestRunner.java:609)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
所以,我不明白问题从何而来。我试着用SquirreSQL执行这个sql脚本——它可以工作。在我的应用程序中,我有一个包含查询文本的正确字符串。当我试图基于这个查询执行语句时,我得到了这个错误。有人遇到过这样的问题吗

更新 我已将文件的迎面编码更改为UTF-8(旧的-没有BOM的UTF-8)。现在我得到了:
db2sql错误:SQLCODE:-104,SQLSTATE:42601,SQLERRMC:PAY;融入;JOIN

准备前您是否打印了声明?QueryString为什么在错误消息中有分号?是的,我已经在准备之前打印了声明-没关系
Short Description: ILLEGAL SYMBOL SOME SYMBOLS THAT MIGHT BE LEGAL ARE

A syntax error was detected where the symbol ?token? occurs in the SQL statement. The list of symbols that might be legal shows some alternate symbols that could possibly be correct at that point, if the preceding part of the statement is entirely correct. However, the preceding part of the statement might be incorrect. For example, if an important keyword is omitted, DB2 detects the error later, and not always immediately after the point where the keyword should appear. The list of alternate symbols are only suggestions. Some of those symbols might not even be legal for statements to be executed by DB2. Those symbols are possibly correct for statements sent to other database management systems. This SQL code will also be issued if the RELEASE TO SAVEPOINT statement is specified without a savepoint name. System action: The statement cannot be executed. Programmer response: Correct the statement and execute it again.