Bug #27915 The resultset from getColumns() doesn't contain required columns
Submitted: 18 Apr 2007 8:45 Modified: 11 Sep 2007 18:36
Reporter: Alexander Hristov (Candidate Quality Contributor)
Status: Closed
Category:Connector/J Severity:S3 (Non-critical)
Version:5.0.5 OS:Any
Assigned to: Target Version:
Tags: database metadata, getColumns

[18 Apr 2007 8:45] Alexander Hristov
Description:
The ResultSet returned from DatabaseMetaData.getColumns() does not contain the following
columns:

SCOPE_CATLOG 
SCOPE_SCHEMA 
SCOPE_TABLE 
SOURCE_DATA_TYPE 
IS_AUTOINCREMENT 

This fails regardless of the value of useInformationSchema

How to repeat:
import java.sql.*;

public class Test {
  public static void main(String[] args) throws Exception {
    Class.forName("com.mysql.jdbc.Driver");
    Properties properties = new Properties();
    properties.setProperty("user","...");
    properties.setProperty("password","...");
    properties.setProperty("useInformationSchema","...");
    properties.setProperty("nullCatalogMeansCurrent","...");
    con = DriverManager.getConnection("jdbc:mysql://localhost/test",properties);
    DatabaseMetaData dbmt = con.getMetaData();
    ResultSet rs = dbmt.getColumns("mysql",null,"user","%");
    ResultSetMetaData rsmt = rs.getMetaData();
    for (int i = 1; i <= rsmt.getColumnCount();i++)
     System.out.println(rsmt.getColumnName(i));
  }
}
[24 Apr 2007 12:19] Sveta Smirnova
test case

Attachment: bug27915_2.java (text/plain), 2.74 KiB.

[24 Apr 2007 12:27] Sveta Smirnova
Thank you for the report.

Verified as described.
[4 Sep 2007 20:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33659
[4 Sep 2007 20:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33662
[4 Sep 2007 20:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33663
[4 Sep 2007 20:45] Mark Matthews
Will be in 5.0.8/5.1.3.
[6 Sep 2007 17:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33832
[7 Sep 2007 16:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33909
[11 Sep 2007 18:36] MC Brown
A note has been added to the 5.0.8 and 5.1.3 changelogs: 

DatabaseMetaData.getColumns() doesn't contain SCOPE_* or IS_AUTOINCREMENT columns.
[3 Oct 2007 18:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34839
[3 Oct 2007 18:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34840
[3 Oct 2007 20:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34855
[5 Oct 2007 20:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35011
[11 Oct 2007 22:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35407
[11 Oct 2007 22:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35410
[11 Oct 2007 22:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35414
[19 Nov 2007 1:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38019
[19 Nov 2007 3:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38024
[9 Sep 13:39] Hack Kampbjørn
The fix has misspelled SCOPE_CATLOG as SCOPE_CATALOG
[9 Sep 15:27] Mark Matthews
It's supposed to be "SCOPE_CATALOG" not "SCOPE_CATLOG", are you working with documentation
that has a bug?