zoukankan      html  css  js  c++  java
  • com.mysql.jdbc.exceptions.MySQLSyntaxErrorException错误

    com.mysql.jdbc.exceptions.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 'receiverTel='123131' payment=0,time ='2015-04-10 10:14', tradeTime='',sndgoodsTi' at line 1 at 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)

     这是因为receiverTel与payment少了一个逗号,

    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 (11 > number of paramete,which is 0);
    

     这个错误是因为少写了一个?,在查询数据库代码中。

  • 相关阅读:
    rdesktop ERROR: CredSSP: Initialize failed, do you have correct kerberos tgt initialized ? Failed to connect, CredSSP required by server
    nginx 服务器重启命令,关闭
    Libvirt磁盘加密
    qemu-nbd使用教程
    交叉编译Spice-gtk
    通过Python调用Spice-gtk
    远程桌面连接KVM虚拟机
    虚拟创建失败之Dbus调试
    Libvirt代码架构
    Libvirt外部快照
  • 原文地址:https://www.cnblogs.com/ouysq/p/4537776.html
Copyright © 2011-2022 走看看