I am creating a table dynamically. <statement id="createIndexTable" parameterClass="....IndexTableLoaderModel"> 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 ); </statement>
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-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org