org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM
2014-08-14 08:41
666 查看
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM DEMO_ORDER WHERE 1=1and order_id = '1']; 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 'order_id = '1'' at line 1
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
......
......
......
这个错误主要sql语句出错了,在自己查找的时候,感觉逻辑没有错误,一直找不到错误。
原来的sql语句如下:
String sql = "select * from demo_order";
sql.append("and order_id = '"+ searchValue +"');
经过仔细研究,将整句话拼接:select * from demo_orderand order_id = '"+ searchValue +"';
错误就变得十分明显了,and前面缺少空格,导致dql语句报错。
check the manual that corresponds to your MySQL server version for the right syntax to use near 'order_id = '1'' at line 1
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
......
......
......
这个错误主要sql语句出错了,在自己查找的时候,感觉逻辑没有错误,一直找不到错误。
原来的sql语句如下:
String sql = "select * from demo_order";
sql.append("and order_id = '"+ searchValue +"');
经过仔细研究,将整句话拼接:select * from demo_orderand order_id = '"+ searchValue +"';
错误就变得十分明显了,and前面缺少空格,导致dql语句报错。
相关文章推荐
- org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar
- SSM_bug整理:org.springframework.jdbc.BadSqlGrammarException:
- org.springframework.jdbc.BadSqlGrammarException: Cause: java.sql.SQLException: Column count 异常
- org.springframework.jdbc.BadSqlGrammarException: Cause: java.sql.SQLException: Column count doesn't
- org.springframework.jdbc.BadSqlGrammarException:
- org.springframework.jdbc.BadSqlGrammarException:
- org.springframework.jdbc.BadSqlGrammarException: Cause: java.sql.SQLException: Column count 异常
- Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException
- org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: Unknown column 'viewpoint' in 'field list'
- 关于org.springframework.jdbc.BadSqlGrammarException
- FAQ(40):org.springframework.jdbc.BadSqlGrammarException: ### Error updating database. Cause: com.m
- Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
- org.springframework.jdbc.BadSqlGrammarException
- spring更新clob报错:org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL
- HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram
- HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram
- HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram
- org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLExcepti
- org.springframework.jdbc.UncategorizedSQLException:
- org.springframework.jdbc.UncategorizedSQLException