Bug #69247 | MySQL jdbc conncetivity | ||
---|---|---|---|
Submitted: | 15 May 2013 20:49 | Modified: | 16 May 2013 0:31 |
Reporter: | Skand Purohit | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.5 | OS: | Windows (Connector used : mysql-connector-java-3.1.12.jar) |
Assigned to: | CPU Architecture: | Any | |
Tags: | java, jdbc, MySQL |
[15 May 2013 20:49]
Skand Purohit
[15 May 2013 22:18]
Mark Matthews
You want to use ps.executeUpdate(), not ps.executeUpdate(String).
[15 May 2013 22:33]
Todd Farmer
Amplifying Mark's comments, executeUpdate() is defined by PreparedStatement, while executeUpdate(String sql) is defined by Statement. The API docs help explain why SQL with prepared statement placeholders isn't handled as you expected when executeUpdate(String sql) is used: http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/PreparedStatement.html#executeUpdate... http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/Statement.html#executeUpdate%28java.... As a separate note, please consider upgrading to a recent version of Connector/J - 3.1.12 is over 7 years old, and many bugs have been fixed since then (along with meaningful features added).
[16 May 2013 0:31]
Skand Purohit
Thank you Mark and Todd it works now . Appreciate your quick response. Todd , also I have added the latest my sql java connector jar.