| Bug #44862 | getBestRowIdentifier does not return resultset as per JDBC API specifications | ||
|---|---|---|---|
| Submitted: | 14 May 10:38 | Modified: | 26 May 12:49 |
| Reporter: | Vivekanand Bachche | ||
| Status: | Closed | ||
| Category: | Connector/J | Severity: | S3 (Non-critical) |
| Version: | 5.1.7 | OS: | Microsoft Windows |
| Assigned to: | Target Version: | ||
| Triage: | Needs Triage: D4 (Minor) | ||
[14 May 12:40]
Vivekanand Bachche
Logical cause and fix looks to be simialar for following bugs- 44791 44862 44863 44865 44867 44868 44869
[14 May 13:09]
Vivekanand Bachche
Please exclude 44791 from the list in my previous comment.
[14 May 18:53]
Valeriy Kravchuk
Thank you for the problem report.
[22 May 22:55]
Mark Matthews
Fixed, see http://bazaar.launchpad.net/~mark-mysql/connectorj/5.1/revision/793
[26 May 12:49]
Tony Bedford
An entry was added to the 5.1.8 changelog: The result set returned by getBestRowIdentifier() did not have the format defined in the JDBC API specifications. The third column, DATA_TYPE, of the result set should be of type INTEGER. Connector/J however returns SMALLINT.

Description: Result set returned by getBestRowIdentifier (Database metadata) does not have format as defined in the specifications. Third column i.e. "DATA_TYPE", of the result set is expected to be of type ‘integer’ where MySQL driver returns it as ‘smallint’. This can give critical problems with BI tools which perform strict checking before retreiving metadata information. How to repeat: public void testMetadata() { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb?user=myself&password=mypassword"); DatabaseMetaData metadata = connection.getMetaData(); ResultSet bestRowIdentifiers = metadata.getBestRowIdentifier("mysql", null, "db", DatabaseMetaData.bestRowNotPseudo, true); ResultSetMetaData rsmd = bestRowIdentifiers.getMetaData(); System.out.println("Column Name is : " + rsmd.getColumnName(3)); // It is “DATA_TYPE” System.out.println("Column Type is : " + rsmd.getColumnType(3)); // Expected type here is Integer i.e. 4 }