title: DB2 SQLSTATE 42601 while executing query
body: <p>I have an sql-query stored in file.
  Here is the beginning of the query:</p>
  
  <pre><code>merge
      into SCHEMA.TABLE as A
      using (
          values (599999991, '2012-12-31',......
  </code></pre>
  
  <p>I have a Java-application and load the query into the String object - it's ok. Then I do the following:</p>
  
  <pre><code>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();
  </code></pre>
  
  <p>queryString is loaded correctly.
  preparedStatement should be ok too - I don't have any parameters in the query.
  But I got an exception:</p>
  
  <pre><code>com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601,   SQLERRMC: into SCHEMA.TABLE as A    using (        values (599;merge    ;&lt;space&gt;
  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)
  </code></pre>
  
  <p>In my sql-query I got "599;merge    ;" instead of "599999991"</p>
  
  <p>I've googled for this error, here is the explanation:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>So, I don't understand where the problem comes from. I tryed to execute this sql-script in SquirrelSql - it works. In my application I have a correct String which contains the text of the query. And when I try to execute Statement based on this query I got this error. Have anybody faced such problem?</p>
  
  <p><strong>UPDATE</strong>
  I've changed the oncoding of the file to UTF-8 (old - UTF-8 without BOM). Now I got:
      DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: PAY;merge    into ;JOIN</p>