Bug #22252 | PreparedStatement with parameters results in MySQLSyntaxErrorException | ||
---|---|---|---|
Submitted: | 11 Sep 2006 23:26 | Modified: | 12 Sep 2006 0:41 |
Reporter: | e2e4e7e5f2f4 e2e4e7e5f2f4 | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 5.0.3 | OS: | Windows (Windows XP) |
Assigned to: | CPU Architecture: | Any |
[11 Sep 2006 23:26]
e2e4e7e5f2f4 e2e4e7e5f2f4
[11 Sep 2006 23:27]
e2e4e7e5f2f4 e2e4e7e5f2f4
BugPreparedStatement.java
Attachment: BugPreparedStatement.java (text/x-java), 3.74 KiB.
[12 Sep 2006 0:41]
Mark Matthews
Your testcase shows that you're calling Statement.execute(String) (not PreparedStatement.execute()). In actuality, you're executing stmt.execute("INSERT INTO mytable (col1,col2) VALUES(?,?)"), which of course is not what you want, because it is definitely a syntax error. One executes _prepared_ statements via the execute() methods that don't take a String-typed query.