2012-11-25 36 views
-1

異常Java的春天 - 試圖調用

Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [\. D:\Documents\workspace-sts-3.0.0.RELEASE\groupbased\src\test\resources\stress\storedProcedures.sql]; nested exception is com.mysql.jdbc.exceptions.jdbc4.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 '\. D:\Documents\workspace-sts-3.0.0.RELEASE\groupbased\src\test\resources\stress' at line 1 

的Java代碼

template.execute("USE example_db;"); 
template.execute("\\. D:\\Documents\\workspace-sts-3.0.0.RELEASE\\groupbased\\src\\test\\resources\\stress\\storedProcedures.sql"); 

(模板是一個JdbcTemplate)

我可以通過MySQL控制檯運行正常的命令時的JdbcTemplate BadSqlGrammarException ,但是當我嘗試通過JDBCTemplate執行時會出現此錯誤。有什麼建議麼?

+0

請嘗試閱讀javadocs。 – duffymo

+0

仍然錯..... – duffymo

回答