server-mysql这种错误: check the manual that ···
错误信息如下:
Exception in thread "main" 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(doctor,patientid,wtime,isread)values('5556','3456789065','2011-10-09',0)' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192)
at com.patient.dao.orderDao.addOrder(orderDao.java:27)
at com.patient.action.orderAction.main(orderAction.java:20)
说是语法错误吗?但是我看了好久都没看出来,求大神指点,谢谢!
回复内容:
表名不要使用order。
order在MySQL中是关键字,你整个SQL语句传进去执行的时候,可能会判断成关键字,而非判断成表名,然后提示你SQL语句错误。
所以改下表明吧。数据库里是不区分大小写的,这个你应该也知道吧。
order(doctor,patientid,wtime,isread)values('5556','3456789065','2011-10-09',0)'
sql代码错,检查下这4个字段的类型和你后面的是否相符,特别是字符串的长度,是否唯一,类型等。
这个是语法问题,你可以打印出sql语句,然后放到数据库单独执行看看
isread是varchar类型的,第四个?,设置的是setInt?
isread插入的不是varchar类型
isread varchar类型
是不是sql拼接的问题,你把拼好的sql,在plsql执行一下。。
推荐阅读
-
Mysql错误:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
-
check the manual that corresponds to your MySQL server version for the right syntax的错误解析,correspondssyntax
-
check the manual that corresponds to your MySQL server version for the right syntax的错误解析,correspondssyntax
-
错误代码: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser
-
server-mysql这种错误: check the manual that ···
-
server-mysql这种错误: check the manual that ···
-
Mysql 错误 check the manual that corresponds to your MySQL server version for the right syntax to use
-
Mysql错误:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use