getImportedKeys(String catalog, String schema, String table)

Syntax:

ResultSet getImportedKeys(String catalog,
                          String schema,
                          String table)
                          throws SQLException

Description:

Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table). They are ordered by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.

Each primary key column description has the following columns:

PKTABLE_CAT String parent key table catalog (may be null)
PKTABLE_SCHEM String parent key table schema (may be null)
PKTABLE_NAME String parent key table name
PKCOLUMN_NAME String parent key column name
FKTABLE_CAT String foreign key table catalog (may be null) being exported (may be null)
FKTABLE_SCHEM String foreign key table schema (may be null) being exported (may be null)
FKTABLE_NAME String foreign key table name being exported
FKCOLUMN_NAME String foreign key column name being exported
KEY_SEQ short sequence number within foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
UPDATE_RULE short What happens to foreign key when parent key is updated:
  • importedNoAction - do not allow update of parent key if it has been imported
  • importedKeyCascade - change imported key to agree with parent key update
  • importedKeySetNull - change imported key to NULL if its parent key has been updated
  • importedKeySetDefault - change imported key to default values if its parent key has been updated
  • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
DELETE_RULE short What happens to the foreign key when parent key is deleted.
  • importedKeyNoAction - do not allow delete of parent key if it has been imported
  • importedKeyCascade - delete rows that import a deleted key
  • importedKeySetNull - change imported key to NULL if its primary key has been deleted
  • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
FK_NAME String foreign key name (may be null)
PK_NAME String parent key name (may be null)
DEFERABILITY short can the evaluation of foreign key constraints be deferred until commit
  • importedKeyInitiallyDeferred - see SQL92 for definition
  • importedKeyInitiallyImmediate - see SQL92 for definition
  • importedKeyNotDeferrable - see SQL92 for definition

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

Returns:

ResultSet - each row is a primary key column description

Throws:

SQLException - if a database access error occurs