Bug #27915 The resultset from getColumns() doesn't contain required columns

Submitted: 18 Apr 2007 6:45 Modified: 11 Sep 2007 16:36
Reporter: Alexander Hristov (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.0.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: database metadata, getColumns

[18 Apr 2007 6: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 10:19] Sveta Smirnova
test case

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

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

Verified as described.
[4 Sep 2007 18: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 18: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 18: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 18:45] Mark Matthews
Will be in 5.0.8/5.1.3.
[6 Sep 2007 15: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 14: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 16: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 16: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 16: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 18: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 18: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 20: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 20: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 20: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 0: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 2: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 2009 11:39] Hack Kampbjørn
The fix has misspelled SCOPE_CATLOG as SCOPE_CATALOG
[9 Sep 2009 13:27] Mark Matthews
It's supposed to be "SCOPE_CATALOG" not "SCOPE_CATLOG", are you working with documentation that has a bug?
[10 Feb 2010 20:14] Matthew Justin
It is spelled SCOPE_CATLOG in the Sun Javadocs:

http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getColumns%28java.lan...
[11 Feb 2010 7:53] Tonci Grgin
Matthew, will notify Mark again.
[17 Jun 2010 20:02] Matthew Justin
What is the status of the "SCOPE_CATLOG" vs. "SCOPE_CATALOG" issue?
[17 Jun 2010 20:16] Mark Matthews
What I heard back from the JDBC expert group is it's a bug in the specification itself. Drivers should return SCOPE_CATALOG, not SCOPE_CATLOG (and most seem to).

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.077 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.