Access database metadata

To access information about the HCL OneDB™ database, use the JDBC API DatabaseMetaData interface.

HCL OneDB JDBC Driver implements all the JDBC 3.0 specifications for DatabaseMetaData methods.

The following methods in DatabaseMetaData are included in HCL OneDB JDBC Driver for JDBC 3.0 compliance:
  • getSuperTypes()
  • getSuperTables()
  • getAttributes()
  • getResultSetHoldability()
  • getDatabaseMajorVersion()
  • getDatabaseMinorVersion()
  • getJDBCMajorVersion()
  • getJDBCMinorVersion()
  • getSQLStateType()
  • locatorsUpdateCopy()
  • supportsGetGeneratedKeys()
  • supportsMultipleOpenResults()
  • supportsNamedParameters()
  • supportsGetGeneratedKeys()
  • supportsMultipleOpenResults()
Methods retrieve server-generated keys. Retrieving autogenerated keys involves the following actions:
  1. The JDBC application programmer provides an SQL statement to be executed.
  2. The server executes the SQL statement and an indication that autogenerated keys can be retrieved is returned.
  3. Before the server executes the SQL statement, columnNames or columnIndexes (if provided) are validated. An SQLException is thrown if they are invalid.
  4. If requested, the JDBC driver and server returns a resultSet object. If no keys were generated, the resultSet is empty, containing no rows or columns.
  5. The user can request metadata for the resultSet object, and the JDBC driver and server returns a resultSetMetaData Object.

For more information about retrieving autogenerated keys, see the JDBC 3.0 Specification, Section 13.6, “Retrieving Auto Generated Keys."

HCL OneDB JDBC Driver uses the sysmaster database to get database metadata. If you want to use the DatabaseMetaData interface in your Java™ program, the sysmaster database must exist in the HCL OneDB database server to which your Java program is connected.

HCL OneDB JDBC Driver interprets the JDBC API term schemas to mean the names of HCL OneDB users who own tables. The DatabaseMetaData.getSchemas() method returns all the users found in the owner column of the systables system catalog.

Similarly, HCL OneDB JDBC Driver interprets the JDBC API term catalogs to mean the names of HCL OneDB databases. The DatabaseMetaData.getCatalogs() method returns the names of all the databases that currently exist in the HCL OneDB database server to which your Java program is connected.

The example DBMetaData.java shows how to use the DatabaseMetaData and ResultSetMetaData interfaces to gather information about a new procedure. Refer to Sample code files for more information about this example.