Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 68931 invoked from network); 12 Apr 2010 22:18:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Apr 2010 22:18:03 -0000 Received: (qmail 16792 invoked by uid 500); 12 Apr 2010 22:18:03 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 16770 invoked by uid 500); 12 Apr 2010 22:18:03 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 16763 invoked by uid 99); 12 Apr 2010 22:18:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Apr 2010 22:18:03 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Apr 2010 22:17:56 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1O1Rwl-0006fO-1d for user-java@ibatis.apache.org; Mon, 12 Apr 2010 15:17:35 -0700 Message-ID: <28219193.post@talk.nabble.com> Date: Mon, 12 Apr 2010 15:17:35 -0700 (PDT) From: Corporate Tool To: user-java@ibatis.apache.org Subject: Ibatis Mysql Sql error but sql runs fine MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: mytrashaccount@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org I am creating a table dynamically. CREATE TABLE #tableName# ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHAR(3), date DATE, time TIME, INDEX(time), open_price INT, close_price INT, low_price INT, high_price INT, changes TINYINT, volumes INT ); It looks like the parameter is there it's just not being replaced correctly. Any Ideas? I get the following from the log4j console-- DEBUG 04-12 17:08:29 {conn-100008} Preparing Statement: CREATE TABLE ? ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHAR(3), date DATE, time TIME, INDEX(time), open_price INT, close_price INT, low_price INT, high_price INT, changes TINYINT, volumes INT ); (JakartaCommonsLoggingImpl.java:27) DEBUG 04-12 17:08:29 {pstm-100009} Executing Statement: CREATE TABLE ? ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHAR(3), date DATE, time TIME, INDEX(time), open_price INT, close_price INT, low_price INT, high_price INT, changes TINYINT, volumes INT ); (JakartaCommonsLoggingImpl.java:27) DEBUG 04-12 17:08:29 {pstm-100009} Parameters: [VIX] (JakartaCommonsLoggingImpl.java:27) DEBUG 04-12 17:08:29 {pstm-100009} Types: [java.lang.String] (JakartaCommonsLoggingImpl.java:27) I get the following from stackTrac--- org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in Index.xml. --- The error occurred while applying a parameter map. --- Check the createIndexTable-InlineParameterMap. --- Check the statement (update failed). --- Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''VIX' ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHA' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:230) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:197) at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:368) at blintz.dyndns.org.zSystemProject.dao.impl.IndexTableLoaderDaoImpl.createTable(IndexTableLoaderDaoImpl.java:11) at blintz.dyndns.org.zSystemProject.service.impl.IndexServiceImpl.loadIndex(IndexServiceImpl.java:50) at blintz.dyndns.org.zSystemProject.DataLoadTest.tryTest(DataLoadTest.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in Index.xml. --- The error occurred while applying a parameter map. --- Check the createIndexTable-InlineParameterMap. --- Check the statement (update failed). --- Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''VIX' ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHA' at line 1 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82) at org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:370) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) ... 28 more Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''VIX' ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, symbol CHA' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1051) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1367) at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:256) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:62) at $Proxy5.execute(Unknown Source) at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:81) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78) ... 32 more -- View this message in context: http://old.nabble.com/Ibatis-Mysql-Sql-error-but-sql-runs-fine-tp28219193p28219193.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org