Thursday, June 13, 2013
java.sql.SQLException: No value specified for parameter 3
#Problem:
(1)
java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 'PRIMARY'"
(2)
java.sql.SQLException: No value specified for parameter 3
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2368)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1799)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1667)
pst = con.prepareStatement(sql);
pst.setString(1, "Rakesh");
pst.setString(2, "Kanwal");
pst.setString(3, "Delhi");
pst.setString(4, null);
ResultSet + prepared statement
If you have access to the prepared statement that results in this resultset, you can use
This prepares your statement in a way that you can rewind the cursor. This is also documented in the ResultSet Javadoc:
In general, however, forwarding and rewinding cursors may be quite inefficient for large result sets. Another option in SQL Server would be to calculate the total number of rows directly in your SQL statement:
|
Subscribe to:
Posts (Atom)