Home > Database > Mysql Tutorial > body text

Server-mysql error: check the manual that ···

WBOY
Release: 2016-12-01 00:00:01
Original
1685 people have browsed it

mysqlserver

Server-mysql error: check the manual that ···Server-mysql error: 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个字段的类型和你后面的是否相符,特别是字符串的长度,是否唯一,类型等。

Server-mysql error: check the manual that ···

这个是语法问题,你可以打印出sql语句,然后放到数据库单独执行看看

isread是varchar类型的,第四个?,设置的是setInt?

isread插入的不是varchar类型

isread varchar类型

是不是sql拼接的问题,你把拼好的sql,在plsql执行一下。。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!