[BUG] regression introduced in 7.4.1. DatbaseMetadata.getColumns fails to return metadata when values escaped #1139
Labels
Bug
A bug in the driver. A high priority item that one can expect to be addressed quickly.
Driver version
7.4.1
SQL Server version
14.00.3612
Client Operating System
any
JAVA/JVM version
IBM Java 8 S5 FP35
Table schema
Problem description
The 7.4.1 driver fails to return a result set from DatabaseMetadata.getColumns when the table name parameter has escaped the underscore in the table name.
This is an introduced issue in 7.4.1.
Did not happen in prior releases such as 7.2.1 or earlier
Scenario#1 - getTables
ResultSet rs = dbMeta.getTables( "dbcert", "dbo", "TPATT\_1\_1", null );
DatabaseMetadata Interface: [getDatabaseProductName(Microsoft SQL Server) getDatabaseMajorVersion(14) getDatabaseMinorVersion(0) getDatabaseProductVersion(14.00.3162)]
DatabaseMetadata Interface getJDBCMajor(4) getJDBCMinor(2)
DatabaseMetadata Interface: [getDriverName(Microsoft JDBC Driver 7.2 for SQL Server) getDriverVersion(7.2.1.0)]
Database says search escape is \
Get Tables
Column Name:TABLE_CAT, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_SCHEM, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_TYPE, display size:32, type name:varchar, type id:12, precision:32, scale:0 () () ()
Column Name:REMARKS, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
[DBCERT],[dbo],[TPATT_1_1],[TABLE],[null]
Rows printed 1
Scenario#2 - getColumns
ResultSet rs = dbMeta.getColumns( "dbcert", "dbo", "TPATT\_1\_1", "%");
DatabaseMetadata Interface: [getDatabaseProductName(Microsoft SQL Server) getDatabaseMajorVersion(14) getDatabaseMinorVersion(0) getDatabaseProductVersion(14.00.3162)]
DatabaseMetadata Interface getJDBCMajor(4) getJDBCMinor(2)
DatabaseMetadata Interface: [getDriverName(Microsoft JDBC Driver 7.2 for SQL Server) getDriverVersion(7.2.1.0)]
Database says default isolation level is 2
Database says search escape is
Database says subquery quantified is true
Get Tables
Column Name:TABLE_CAT, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_SCHEM, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_TYPE, display size:32, type name:varchar, type id:12, precision:32, scale:0 () () ()
Column Name:REMARKS, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
[DBCERT],[dbo],[TPATT_1_1],[TABLE],[null]
Rows printed 1
Get Table Columns
Columns 292
Column Name:TABLE_CAT, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_SCHEM, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:COLUMN_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:DATA_TYPE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:TYPE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:COLUMN_SIZE, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:BUFFER_LENGTH, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:DECIMAL_DIGITS, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:NUM_PREC_RADIX, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:NULLABLE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:REMARKS, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
Column Name:COLUMN_DEF, display size:4000, type name:nvarchar, type id:-9, precision:4000, scale:0 () () ()
Column Name:SQL_DATA_TYPE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:SQL_DATETIME_SUB, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:CHAR_OCTET_LENGTH, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:ORDINAL_POSITION, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:IS_NULLABLE, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
Column Name:SS_IS_SPARSE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:SS_IS_COLUMN_SET, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:IS_GENERATEDCOLUMN, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:IS_AUTOINCREMENT, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:SS_UDT_CATALOG_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_UDT_SCHEMA_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_UDT_ASSEMBLY_TYPE_NAME, display size:4000, type name:nvarchar, type id:-9, precision:4000, scale:0 () () ()
Column Name:SS_XML_SCHEMACOLLECTION_CATALOG_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_XML_SCHEMACOLLECTION_SCHEMA_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_XML_SCHEMACOLLECTION_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_DATA_TYPE, display size:3, type name:tinyint, type id:-6, precision:3, scale:0 () () ()
[DBCERT],[dbo],[TPATT_1_1],[RNUM],[4],[int],[10],[4],[0],[10],[0],[null],[null],[4],[null],[null],[1],[NO],[0],[0],[0],[NO],[null],[null],[null],[null],[null],[null],[56]
[DBCERT],[dbo],[TPATT_1_1],[C_1],[4],[int],[10],[4],[0],[10],[1],[null],[null],[4],[null],[null],[2],[YES],[0],[0],[0],[NO],[null],[null],[null],[null],[null],[null],[38]
[DBCERT],[dbo],[TPATT_1_1],[C11],[4],[int],[10],[4],[0],[10],[1],[null],[null],[4],[null],[null],[3],[YES],[0],[0],[0],[NO],[null],[null],[null],[null],[null],[null],[38]
[DBCERT],[dbo],[TPATT_1_1],[C%1],[4],[int],[10],[4],[0],[10],[1],[null],[null],[4],[null],[null],[4],[YES],[0],[0],[0],[NO],[null],[null],[null],[null],[null],[null],[38]
[DBCERT],[dbo],[TPATT_1_1],[C\1\1],[4],[int],[10],[4],[0],[10],[1],[null],[null],[4],[null],[null],[5],[YES],[0],[0],[0],[NO],[null],[null],[null],[null],[null],[null],[38]
Rows printed 5
DatabaseMetadata Interface: [getDatabaseProductName(Microsoft SQL Server) getDatabaseMajorVersion(14) getDatabaseMinorVersion(0) getDatabaseProductVersion(14.00.3162)]
DatabaseMetadata Interface getJDBCMajor(4) getJDBCMinor(2)
DatabaseMetadata Interface: [getDriverName(Microsoft JDBC Driver 7.4 for SQL Server) getDriverVersion(7.4.1.0)]
Database says search escape is \
Column Name:TABLE_CAT, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_SCHEM, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_TYPE, display size:32, type name:varchar, type id:12, precision:32, scale:0 () () ()
Column Name:REMARKS, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
[DBCERT],[dbo],[TPATT_1_1],[TABLE],[null]
Rows printed 1
Get Table Columns
Columns 463
Column Name:TABLE_CAT, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_SCHEM, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:TABLE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:COLUMN_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:DATA_TYPE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:TYPE_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:COLUMN_SIZE, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:BUFFER_LENGTH, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:DECIMAL_DIGITS, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:NUM_PREC_RADIX, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:NULLABLE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:REMARKS, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
Column Name:COLUMN_DEF, display size:4000, type name:nvarchar, type id:-9, precision:4000, scale:0 () () ()
Column Name:SQL_DATA_TYPE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:SQL_DATETIME_SUB, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:CHAR_OCTET_LENGTH, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:ORDINAL_POSITION, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:IS_NULLABLE, display size:254, type name:varchar, type id:12, precision:254, scale:0 () () ()
Column Name:SCOPE_CATALOG, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:SCOPE_SCHEMA, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:SCOPE_TABLE, display size:11, type name:int, type id:4, precision:10, scale:0 () () ()
Column Name:SOURCE_DATA_TYPE, display size:3, type name:tinyint, type id:-6, precision:3, scale:0 () () ()
Column Name:IS_AUTOINCREMENT, display size:3, type name:varchar, type id:12, precision:3, scale:0 () () ()
Column Name:IS_GENERATEDCOLUMN, display size:3, type name:varchar, type id:12, precision:3, scale:0 () () ()
Column Name:SS_IS_SPARSE, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:SS_IS_COLUMN_SET, display size:6, type name:smallint, type id:5, precision:5, scale:0 () () ()
Column Name:SS_UDT_CATALOG_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_UDT_SCHEMA_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_UDT_ASSEMBLY_TYPE_NAME, display size:1073741823, type name:nvarchar, type id:-9, precision:1073741823, scale:0 () () ()
Column Name:SS_XML_SCHEMACOLLECTION_CATALOG_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_XML_SCHEMACOLLECTION_SCHEMA_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Column Name:SS_XML_SCHEMACOLLECTION_NAME, display size:128, type name:nvarchar, type id:-9, precision:128, scale:0 () () ()
Rows printed 0
The text was updated successfully, but these errors were encountered: