DatabaseMetaData.getBestRowIdentifier

DatabaseMetaData.getBestRowIdentifier

Interface Overview | Interface Members | This Package | All Packages

Syntax
public abstract ResultSet getBestRowIdentifier( String catalog, String schema, String table, int scope, boolean nullable ) throws SQLException
Parameters
catalog
a catalog name; "" retrieves those without a catalog; null means drop catalog name from the selection criteria
schema
a schema name; "" retrieves those without a schema
table
a table name
scope
the scope of interest; use same values as SCOPE
nullable
include columns that are nullable?
Returns
ResultSet - each row is a column description
Description
Get 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:

  1. 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
  2. COLUMN_NAME String => column name
  3. DATA_TYPE short => SQL data type from java.sql.Types
  4. TYPE_NAME String => Data source dependent type name
  5. COLUMN_SIZE int => precision
  6. BUFFER_LENGTH int => not used
  7. DECIMAL_DIGITS short => scale
  8. 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

Exceptions
SQLException if a database-access error occurs.