一、問題
運行java代碼時報如下的錯誤:
You have an error in your SQL syntax;Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'analyze' at line 6
二、解決
1.檢查sql是否正確,大多數情況都是因為sql寫錯了,如果覺得sql沒寫錯,那么很有可能是sql語句中使用了mysql的關鍵字和保留字段。
我這里就是因為使用 analyze 作為字段。mysql的關鍵字和保留字段:https://www.cnblogs.com/wuyifu/p/5949764.html
2.檢查代碼中傳的參數是否正確