Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5613

DatabaseMetadata.getTables throws exception when null used for catalog/schema or % used for schema

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.10.0
    • None
    • Client - JDBC
    • None

    Description

      DatabaseMetadata.getTables supports being passed a NULL value for a catalog/schema and % for schema.

      A very basic call to introspect a database without explicitly passing a schema name (i.e. %) doesn't work making the driver essentially useless.

      It will only function is someone presumes that an application knows the schema name it is looking for or is iterating the Resultset from getSchemas and then nested looping on getTables.

      https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getTables-java.lang.String-java.lang.String-java.lang.String-java.lang.String:A-

      Doing so results in a JDBC exception from Drill

      java.sql.SQLException: Failure getting metadata:
      at org.apache.drill.jdbc.impl.DrillMetaImpl$MetadataAdapter.getMeta(DrillMetaImpl.java:310)
      at org.apache.drill.jdbc.impl.DrillMetaImpl.serverGetTables(DrillMetaImpl.java:394)
      at org.apache.drill.jdbc.impl.DrillMetaImpl.getTables(DrillMetaImpl.java:428)
      at oadd.org.apache.calcite.avatica.AvaticaDatabaseMetaData.getTables(AvaticaDatabaseMetaData.java:587)
      at org.apache.drill.jdbc.impl.DrillDatabaseMetaDataImpl.getTables(DrillDatabaseMetaDataImpl.java:1145)

      String [] tableTypes =

      { "VIEW", "SYNONYM", "TABLE"}

      ;

      ResultSet rs = dbMeta.getTables( null, null, "%", tableTypes);
      ResultSet rs = dbMeta.getTables( "DRILL", null, "%", tableTypes);
      ResultSet rs = dbMeta.getTables( "DRILL", "%", "%", tableTypes);

      Attachments

        Activity

          People

            Unassigned Unassigned
            the6campbells N Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: