getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable)

Syntax:

ResultSet getBestRowIdentifier(String catalog,
                               String schema,
                               String table,
                               int scope,
                               boolean nullable)
                               throws SQLException

Description:

Retrieves a description of a table's optimal set of columns that uniquely identifies a row. They are ordered by SCOPE.

Each column description has the following columns:

SCOPE short actual scope of result
  • bestRowTemporary - very temporary, while using row
  • bestRowTransaction - valid for remainder of current transaction
  • bestRowSession - valid for remainder of current session
COLUMN_NAME String column name
DATA_TYPE int SQL data type from java.sql.Types
TYPE_NAME String Data source dependent type name, for a UDT the type name is fully qualified
COLUMN_SIZE int precision
BUFFER_LENGTH int unused
DECIMAL_DIGITS short scale - Null is returned for data types where DECIMAL_DIGITS is not applicable.
PSEUDO_COLUMN short is this a pseudo column like an Oracle ROWID
  • bestRowUnknown - may or may not be pseudo column
  • bestRowNotPseudo - is NOT a pseudo column
  • bestRowPseudo - is a pseudo column

The COLUMN_SIZE column represents the specified column size for the given column. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. Null is returned for data types where the column size is not applicable.

Parameters:

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

schema - a schema name; 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

table - a table name; must match the table name as it is stored in the database

scope - the scope of interest; use same values as SCOPE

nullable - include columns that are nullable.

Returns:

ResultSet - each row is a column description

Throws:

SQLException - if a database access error occurs or the database metadata object is closed