Bug #43666 | MySql java-connector unable to retrieve getExportedKeys when SQL_MODE=ANSI_QUOT | ||
---|---|---|---|
Submitted: | 16 Mar 2009 8:21 | Modified: | 17 Mar 2009 19:05 |
Reporter: | naveen upadhyay | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | mysql-java-connector-5.1.7bin.jar | OS: | Any |
Assigned to: | Jess Balint | CPU Architecture: | Any |
[16 Mar 2009 8:21]
naveen upadhyay
[16 Mar 2009 9:22]
Tonci Grgin
Test case for our test framework.
Attachment: TestBug43666.java (text/x-java), 3.31 KiB.
[16 Mar 2009 9:25]
Tonci Grgin
Hi Naveen and thanks for your report. Verified as described against latest c/J 5.1 sources with test case attached: .Loading JDBC driver 'com.mysql.jdbc.Driver' Done. Done. java.vm.version : 1.5.0_17-b04 java.vm.vendor : Sun Microsystems Inc. java.runtime.version : 1.5.0_17-b04 os : Windows Server 2008, 6.0, x86 sun.management.compiler : HotSpot Client Compiler ------------------------------------------------- Connected to 5.1.31-log F Time: 0,411 There was 1 failure: 1) testBug43666(testsuite.simple.TestBug43666)junit.framework.AssertionFailedError: No rows returned with ANSI_QUOTES Jess, make note of what happens when you use I__S!
[16 Mar 2009 16:59]
naveen upadhyay
suggested fix: As a workaround u can : Unset the SQL_MODE while querying the database for exportedKeys and and then again set the mode just before returning. The same thing i can also do in my application to make child tables work.. However at a generic level it might lead to such mechanism in various other metadata calls..so it wont be a proper solution!
[17 Mar 2009 19:05]
Jess Balint
You are side-stepping the driver by setting ANSI_QUOTES this way. The proper way to set it for the session is in the connection string, using "sessionVariables=sql_mode='ANSI_QUOTES'".