Bug #65705 jdbc method DatabaseMetaData.getTables() getRemarks() not implemented
Submitted: 22 Jun 2012 7:40 Modified: 26 Jun 2012 11:30
Reporter: Dragos Pruteanu Email Updates:
Status: Duplicate Impact on me:
Category:Connector / J Severity:S4 (Feature request)
Version: OS:Any
Assigned to:

[22 Jun 2012 7:40] Dragos Pruteanu
The Java JDBC documentation from DatabaseMetaData.getTables() says that the method should return in resultSet field 5 the table comments. But it does not. This is important for beeing able to keep a large schema documented.

See the Java documentation snippet bellow:


ResultSet getTables(String catalog,
                    String schemaPattern,
                    String tableNamePattern,
                    String[] types)
                    throws SQLException

    Retrieves a description of the tables available in the given catalog. Only table descriptions matching the catalog, schema, table name and type criteria are returned. They are ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM and TABLE_NAME.

    Each table description has the following columns:

        1.TABLE_CAT String => table catalog (may be null)
        2.TABLE_SCHEM String => table schema (may be null)
        3.TABLE_NAME String => table name
        4.TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
        5.REMARKS String => explanatory comment on the table
        6.TYPE_CAT String => the types catalog (may be null)
        7.TYPE_SCHEM String => the types schema (may be null)
        8.TYPE_NAME String => type name (may be null)
        9.SELF_REFERENCING_COL_NAME String => name of the designated "identifier" column of a typed table (may be null)
        10.REF_GENERATION String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null) 

    Note: Some databases may not return information for all tables.

        catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
        schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
        tableNamePattern - a table name pattern; must match the table name as it is stored in the database
        types - a list of table types, which must be from the list of table types returned from getTableTypes(),to include; null returns all types 
        ResultSet - each row is a table description 
        SQLException - if a database access error occurs
    See Also:

How to repeat:
CREATE TABLE test ( id integer primary key );
ALTER TABLE test COMMENT 'asdfasdf';

final ResultSet rs = transaction.getMetaData().getTables( schema.getCatalogName(), schema.getSchemaName(), null, new String[]{"TABLE", "VIEW"});
        while (rs.next()) {
            String tableName = rs.getString(3);
            String comment = rs.getString(5);  
            System.out.println( tableName + " comment: " + comment );
[26 Jun 2012 11:30] Valerii Kravchuk
This is a duplicate of bug #65213.