Com.mysql.jdbc.exceptions.MySQLSyntaxErrorException Error

Source: Internet
Author: User

Com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:You has an error in your SQL syntax; Check the manual that corresponds to your MySQL
Server version for the right syntax-use near ' receivertel= ' 123131 ' payment=0,time = ' 2015-04-10 10:14 ', tradetime= ', snd Goodsti ' at line 1at com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:936) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:2985) at Com.mysql.jdbc.MysqlIO.sendCommand (Mysqlio.java : 1631) at Com.mysql.jdbc.MysqlIO.sqlQueryDirect (mysqlio.java:1723) at Com.mysql.jdbc.Connection.execSQL ( connection.java:3283) at Com.mysql.jdbc.PreparedStatement.executeInternal (preparedstatement.java:1332) at Com.mysql.jdbc.PreparedStatement.executeUpdate (preparedstatement.java:1604) at Com.mysql.jdbc.PreparedStatement.executeUpdate (preparedstatement.java:1519)

This is because Receivertel and payment are missing a comma,

String sql = "Update em_order set orderid=?,userid=?,receivername=?,receiveraddress=?,postcode=?" Receivertel=?,payment=?,time =?, Tradetime=?,
Sndgoodstime=? State=? WHERE id =? "; Jdbcutils.update (Sql,o.getorderid (), O.getuserid (), O.getreceivername (), o.getreceiveraddress (), O.getPostCode (), O.getreceivertel (),
O.getpayment (), O.gettime (), O.gettradetime (), O.getsndgoodstime (), O.getstate (), O.getid ());

Java.sql.SQLException:Parameter index out of range (one > number of Paramete,which is 0);

This error is due to one less write? In the query database code.

Com.mysql.jdbc.exceptions.MySQLSyntaxErrorException Error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.