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 'where bookTypeName=
'计算机类1',bookTypeDescription='计算机相关类图书' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
就是MySQL语句写错了,检查语法
near 旁边的地方好好查查
我是多写了个where
错的代码:
String sql="update t_booktype set where bookTypeName=?,bookTypeDescription=? where id=?";
对的代码:
String sql="update t_booktype set bookTypeName=?,bookTypeDescription=? where id=?";