Bug #44508 | getSuperTypes return result set with incorrect column names | ||
---|---|---|---|
Submitted: | 28 Apr 2009 8:37 | Modified: | 16 Sep 2009 15:58 |
Reporter: | Vivekanand Bachche | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 5.1.7 | OS: | Windows |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[28 Apr 2009 8:37]
Vivekanand Bachche
[28 Apr 2009 12:51]
Tonci Grgin
Hi Vivekanand and thanks for your report. Please attach small test case demonstrating this behavior.
[28 Apr 2009 13:50]
Vivekanand Bachche
Here is the test program- import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; public class SimpleTest { public static void main(String[] args) { try { String className = "com.mysql.jdbc.Driver"; Class driverObject = Class.forName(className); System.out.println("driverObject = " + driverObject); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase","username","password"); DatabaseMetaData dbMetaData = conn.getMetaData(); ResultSet rs = dbMetaData.getSuperTypes("", "", ""); ResultSetMetaData rsMetaData = rs.getMetaData(); String nameColumn1 = rsMetaData.getColumnName(1); System.out.println("First column name is: " + nameColumn1); String nameColumn2 = rsMetaData.getColumnName(2); System.out.println("Second column name is: " + nameColumn2); } catch (Exception e) { // There was some problem System.out.println("Failed: JDBC Driver Error: " + e.getMessage()); } } }
[4 May 2009 8:04]
Tonci Grgin
Test case for our test framework.
Attachment: TestBug44508.java (text/x-java), 2.10 KiB.
[4 May 2009 8:05]
Tonci Grgin
Thanks Vivekanand. Verified as described with test case attached: .Loading JDBC driver 'com.mysql.jdbc.Driver' Done. Done. Connected to 5.1.31-log 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 ------------------------------------------------- F Time: 0,282 There was 1 failure: 1) testBug44508(testsuite.simple.TestBug44508)junit.framework.ComparisonFailure: expected:<...YP...> but was:<...ABL...> at testsuite.simple.TestBug44508.testBug44508(TestBug44508.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at testsuite.simple.TestBug44508.main(TestBug44508.java:61) FAILURES!!! Tests run: 1, Failures: 1, Errors: 0
[26 Aug 2009 14:27]
Mark Matthews
Fixed for 5.1.9.
[16 Sep 2009 15:58]
Tony Bedford
An entry was added to the 5.1.9 changelog: The getSuperTypes method returned a result set with incorrect names for the first two columns. The name of the first column in the result set was expected to be TYPE_CAT and that of the second column TYPE_SCHEM. The method however returned the names as TABLE_CAT and TABLE_SCHEM for first and second column respectively.