Bug #31457 | JDBC SQL Escape processing {fn ... confused by escaped quotes | ||
---|---|---|---|
Submitted: | 8 Oct 2007 15:46 | Modified: | 2 Mar 2009 18:40 |
Reporter: | Dave Pullin (Basic Quality Contributor) | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | Jdbc-5.0.7 | OS: | Any (atleast Windows and Linux) |
Assigned to: | CPU Architecture: | Any | |
Tags: | qc |
[8 Oct 2007 15:46]
Dave Pullin
[9 Oct 2007 6:26]
Tonci Grgin
Hi Dave and thanks for your report. Verified as described on WinXP Pro SP2 using latest c/J sources. Connected to 5.0.50-pb1046-log java.vm.version : 1.5.0_12-b04 java.vm.vendor : Sun Microsystems Inc. java.runtime.version : 1.5.0_12-b04 os.name : Windows XP os.version : null sun.management.compiler : HotSpot Client Compiler Time: 0,313 There was 1 error: 1) testBug17402(testsuite.simple.TestBug31457)java.sql.SQLException: Not a valid escape sequence: {f') at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:914)
[9 Oct 2007 6:27]
Tonci Grgin
Test case
Attachment: TestBug31457.java (text/java), 1.70 KiB.
[2 Mar 2009 18:40]
Jess Balint
This is a duplicate of bug#42253. Will be fixed in Connector/J 5.1.
[7 Dec 2011 12:35]
David Tonhofer
Probably still present in 5.1.18 Using a test with randomly generated noisy strings, an INSERT of ('string.3', 19, 2, 'S+K9#*I8N4aDhG\'FBE1K_b\'_QJAq&{&^ZzBCXIGBoOsbb&L<KO', NULL) ...among a long sequence of records preceding it, yields: "Not a valid escape sequence: {&^ZzBCXIGBoOsbb&L<KO'" But see Bug#4279, where they say: In any case, '{' is a _reserved_ character in JDBC unless is is _inside_ a '' sequence, so you need to escape it with '\', or alternatively turn off escape processing altogether by calling .setEscapeProcessing(false) on the statement in question. I may check that if more time.
[7 Dec 2011 13:08]
Tonci Grgin
David, please do check as problem reported in bug#42253 is fixed and regression test added. Also, do check your SQL_MODE for NO_BACKSLASH_ESCAPE (NO_BACKSLASH_ESCAPES enables an SQL standard compatibility mode, where backslash is not considered a special character. The result will be that queries will fail.).