This class provides information about the database as a whole.
Many of the methods here return lists of information in ResultSets.
You can use the normal ResultSet methods such as getString and getInt
to retrieve the data from these ResultSets. If a given form of
metadata is not available, these methods should throw a SQLException.
Some of these methods take arguments that are String patterns. These
arguments all have names such as fooPattern. Within a pattern String, "%"
means match any substring of 0 or more characters, and "_" means match
any one character. Only metadata entries matching the search pattern
are returned. If a search pattern argument is set to a null ref, it means
that argument's criteria should be dropped from the search.
A SQLException will be thrown if a driver does not support a meta
data method. In the case of methods that return a ResultSet,
either a ResultSet (which may be empty) is returned or a
SQLException is thrown.
IMPORT KEY UPDATE_RULE and DELETE_RULE - for update, change
imported key to agree with primary key update; for delete,
delete rows that import a deleted key.
Get a description of the foreign key columns in the foreign key
table that reference the primary key columns of the primary key
table (describe how one table imports another's key.) This
should normally return a single foreign key/primary key pair
(most tables only import a foreign key from a table once.) They
are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and
KEY_SEQ.
Does the database treat mixed case unquoted SQL identifiers as
case sensitive and as a result store them in mixed case?
A JDBC-Compliant driver will always return false.
Does the database treat mixed case quoted SQL identifiers as
case sensitive and as a result store them in mixed case?
A JDBC-Compliant driver will always return true.
procedureResultUnknown
public static final int procedureResultUnknown
PROCEDURE_TYPE - May return a result.
procedureNoResult
public static final int procedureNoResult
PROCEDURE_TYPE - Does not return a result.
procedureReturnsResult
public static final int procedureReturnsResult
PROCEDURE_TYPE - Returns a result.
procedureColumnUnknown
public static final int procedureColumnUnknown
COLUMN_TYPE - nobody knows.
procedureColumnIn
public static final int procedureColumnIn
COLUMN_TYPE - IN parameter.
procedureColumnInOut
public static final int procedureColumnInOut
COLUMN_TYPE - INOUT parameter.
procedureColumnOut
public static final int procedureColumnOut
COLUMN_TYPE - OUT parameter.
procedureColumnReturn
public static final int procedureColumnReturn
COLUMN_TYPE - procedure return value.
procedureColumnResult
public static final int procedureColumnResult
COLUMN_TYPE - result column in ResultSet.
procedureNoNulls
public static final int procedureNoNulls
TYPE NULLABLE - does not allow NULL values.
procedureNullable
public static final int procedureNullable
TYPE NULLABLE - allows NULL values.
procedureNullableUnknown
public static final int procedureNullableUnknown
TYPE NULLABLE - nullability unknown.
columnNoNulls
public static final int columnNoNulls
COLUMN NULLABLE - might not allow NULL values.
columnNullable
public static final int columnNullable
COLUMN NULLABLE - definitely allows NULL values.
columnNullableUnknown
public static final int columnNullableUnknown
COLUMN NULLABLE - nullability unknown.
bestRowTemporary
public static final int bestRowTemporary
BEST ROW SCOPE - very temporary, while using row.
bestRowTransaction
public static final int bestRowTransaction
BEST ROW SCOPE - valid for remainder of current transaction.
bestRowSession
public static final int bestRowSession
BEST ROW SCOPE - valid for remainder of current session.
bestRowUnknown
public static final int bestRowUnknown
BEST ROW PSEUDO_COLUMN - may or may not be pseudo column.
bestRowNotPseudo
public static final int bestRowNotPseudo
BEST ROW PSEUDO_COLUMN - is NOT a pseudo column.
bestRowPseudo
public static final int bestRowPseudo
BEST ROW PSEUDO_COLUMN - is a pseudo column.
versionColumnUnknown
public static final int versionColumnUnknown
VERSION COLUMNS PSEUDO_COLUMN - may or may not be pseudo column.
versionColumnNotPseudo
public static final int versionColumnNotPseudo
VERSION COLUMNS PSEUDO_COLUMN - is NOT a pseudo column.
versionColumnPseudo
public static final int versionColumnPseudo
VERSION COLUMNS PSEUDO_COLUMN - is a pseudo column.
importedKeyCascade
public static final int importedKeyCascade
IMPORT KEY UPDATE_RULE and DELETE_RULE - for update, change
imported key to agree with primary key update; for delete,
delete rows that import a deleted key.
importedKeyRestrict
public static final int importedKeyRestrict
IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or
delete of primary key if it has been imported.
importedKeySetNull
public static final int importedKeySetNull
IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to
NULL if its primary key has been updated or deleted.
importedKeyNoAction
public static final int importedKeyNoAction
IMPORT KEY UPDATE_RULE and DELETE_RULE - do not allow update or
delete of primary key if it has been imported.
importedKeySetDefault
public static final int importedKeySetDefault
IMPORT KEY UPDATE_RULE and DELETE_RULE - change imported key to
default values if its primary key has been updated or deleted.
importedKeyInitiallyDeferred
public static final int importedKeyInitiallyDeferred
IMPORT KEY DEFERRABILITY - see SQL92 for definition
importedKeyInitiallyImmediate
public static final int importedKeyInitiallyImmediate
IMPORT KEY DEFERRABILITY - see SQL92 for definition
importedKeyNotDeferrable
public static final int importedKeyNotDeferrable
IMPORT KEY DEFERRABILITY - see SQL92 for definition
typeNoNulls
public static final int typeNoNulls
TYPE NULLABLE - does not allow NULL values.
typeNullable
public static final int typeNullable
TYPE NULLABLE - allows NULL values.
typeNullableUnknown
public static final int typeNullableUnknown
TYPE NULLABLE - nullability unknown.
typePredNone
public static final int typePredNone
TYPE INFO SEARCHABLE - No support.
typePredChar
public static final int typePredChar
TYPE INFO SEARCHABLE - Only supported with WHERE .. LIKE.
typePredBasic
public static final int typePredBasic
TYPE INFO SEARCHABLE - Supported except for WHERE .. LIKE.
typeSearchable
public static final int typeSearchable
TYPE INFO SEARCHABLE - Supported for all WHERE ...
tableIndexStatistic
public static final short tableIndexStatistic
INDEX INFO TYPE - this identifies table statistics that are
returned in conjuction with a table's index descriptions
tableIndexClustered
public static final short tableIndexClustered
INDEX INFO TYPE - this identifies a clustered index
tableIndexHashed
public static final short tableIndexHashed
INDEX INFO TYPE - this identifies a hashed index
tableIndexOther
public static final short tableIndexOther
INDEX INFO TYPE - this identifies some other form of index
Does the database treat mixed case unquoted SQL identifiers as
case sensitive and as a result store them in mixed case?
A JDBC-Compliant driver will always return false.
Does the database treat mixed case quoted SQL identifiers as
case sensitive and as a result store them in mixed case?
A JDBC-Compliant driver will always return true.
What's the string used to quote SQL identifiers?
This returns a space " " if identifier quoting isn't supported.
A JDBC-Compliant driver always uses a double quote character.
If so, the SQL AS clause can be used to provide names for
computed columns or to provide alias names for columns as
required.
A JDBC-Compliant driver always returns true.
Get a description of a catalog's stored procedure parameters
and result columns.
Only descriptions matching the schema, procedure and
parameter name criteria are returned. They are ordered by
PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value,
if any, is first. Next are the parameter descriptions in call
order. The column descriptions follow in column number order.
Each row in the ResultSet is a parameter description or
column description with the following fields:
PROCEDURE_CAT String => procedure catalog (may be null)
PROCEDURE_SCHEM String => procedure schema (may be null)
PROCEDURE_NAME String => procedure name
COLUMN_NAME String => column/parameter name
COLUMN_TYPE Short => kind of column/parameter:
procedureColumnUnknown - nobody knows
procedureColumnIn - IN parameter
procedureColumnInOut - INOUT parameter
procedureColumnOut - OUT parameter
procedureColumnReturn - procedure return value
procedureColumnResult - result column in ResultSet
Get a description of tables available in a catalog.
Only table descriptions matching the catalog, schema, table
name and type criteria are returned. They are ordered by
TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
Get a description of table columns available in a catalog.
Only column descriptions matching the catalog, schema, table
and column name criteria are returned. They are ordered by
TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
Each column description has the following columns:
TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
COLUMN_NAME String => column name
DATA_TYPE short => SQL type from java.sql.Types
TYPE_NAME String => Data source dependent type name
COLUMN_SIZE int => column size. For char or date
types this is the maximum number of characters, for numeric or
decimal types this is precision.
BUFFER_LENGTH is not used.
DECIMAL_DIGITS int => the number of fractional digits
NUM_PREC_RADIX int => Radix (typically either 10 or 2)
NULLABLE int => is NULL allowed?
columnNoNulls - might not allow NULL values
columnNullable - definitely allows NULL values
columnNullableUnknown - nullability unknown
REMARKS String => comment describing column (may be null)
COLUMN_DEF String => default value (may be null)
SQL_DATA_TYPE int => unused
SQL_DATETIME_SUB int => unused
CHAR_OCTET_LENGTH int => for char types the
maximum number of bytes in the column
ORDINAL_POSITION int => index of column in table
(starting at 1)
IS_NULLABLE String => "NO" means column definitely
does not allow NULL values; "YES" means the column might
allow NULL values. An empty string means nobody knows.
Parameters:
catalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
schemaPattern - a schema name pattern; "" retrieves those
without a schema
Get a description of the access rights for each table available
in a catalog. Note that a table privilege applies to one or
more columns in the table. It would be wrong to assume that
this priviledge applies to all columns (this may be true for
some systems but is not true for all.)
Only privileges matching the schema and table name
criteria are returned. They are ordered by TABLE_SCHEM,
TABLE_NAME, and PRIVILEGE.
Each privilige description has the following columns:
TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
GRANTOR => grantor of access (may be null)
GRANTEE String => grantee of access
PRIVILEGE String => name of access (SELECT,
INSERT, UPDATE, REFRENCES, ...)
IS_GRANTABLE String => "YES" if grantee is permitted
to grant to others; "NO" if not; null if unknown
Parameters:
catalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
schemaPattern - a schema name pattern; "" retrieves those
without a schema
tableNamePattern - a table name pattern
Returns:
ResultSet - each row is a table privilege description
Get a description of the primary key columns that are
referenced by a 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 => primary key table catalog
being imported (may be null)
PKTABLE_SCHEM String => primary key table schema
being imported (may be null)
PKTABLE_NAME String => primary key table name
being imported
PKCOLUMN_NAME String => primary key column name
being imported
FKTABLE_CAT String => foreign key table catalog (may be null)
FKTABLE_SCHEM String => foreign key table schema (may be null)
FKTABLE_NAME String => foreign key table name
FKCOLUMN_NAME String => foreign key column name
KEY_SEQ short => sequence number within foreign key
UPDATE_RULE short => What happens to
foreign key when primary is updated:
importedNoAction - do not allow update of primary
key if it has been imported
importedKeyCascade - change imported key to agree
with primary key update
importedKeySetNull - change imported key to NULL if
its primary key has been updated
importedKeySetDefault - change imported key to default values
if its primary key has been updated
importedKeyRestrict - same as importedKeyNoAction
(for ODBC 2.x compatibility)
DELETE_RULE short => What happens to
the foreign key when primary is deleted.
importedKeyNoAction - do not allow delete of primary
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)
importedKeySetDefault - change imported key to default if
its primary key has been deleted
FK_NAME String => foreign key name (may be null)
PK_NAME String => primary key name (may be null)
DEFERRABILITY 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; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
schema - a schema name pattern; "" retrieves those
without a schema
table - a table name
Returns:
ResultSet - each row is a primary key column description
Get a description of the foreign key columns that reference a
table's primary key columns (the foreign keys exported by a
table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM,
FKTABLE_NAME, and KEY_SEQ.
Each foreign key column description has the following columns:
PKTABLE_CAT String => primary key table catalog (may be null)
PKTABLE_SCHEM String => primary key table schema (may be null)
PKTABLE_NAME String => primary key table name
PKCOLUMN_NAME String => primary 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
UPDATE_RULE short => What happens to
foreign key when primary is updated:
importedNoAction - do not allow update of primary
key if it has been imported
importedKeyCascade - change imported key to agree
with primary key update
importedKeySetNull - change imported key to NULL if
its primary key has been updated
importedKeySetDefault - change imported key to default values
if its primary key has been updated
importedKeyRestrict - same as importedKeyNoAction
(for ODBC 2.x compatibility)
DELETE_RULE short => What happens to
the foreign key when primary is deleted.
importedKeyNoAction - do not allow delete of primary
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)
importedKeySetDefault - change imported key to default if
its primary key has been deleted
FK_NAME String => foreign key name (may be null)
PK_NAME String => primary key name (may be null)
DEFERRABILITY 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; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
schema - a schema name pattern; "" retrieves those
without a schema
table - a table name
Returns:
ResultSet - each row is a foreign key column description
Get a description of the foreign key columns in the foreign key
table that reference the primary key columns of the primary key
table (describe how one table imports another's key.) This
should normally return a single foreign key/primary key pair
(most tables only import a foreign key from a table once.) They
are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and
KEY_SEQ.
Each foreign key column description has the following columns:
PKTABLE_CAT String => primary key table catalog (may be null)
PKTABLE_SCHEM String => primary key table schema (may be null)
PKTABLE_NAME String => primary key table name
PKCOLUMN_NAME String => primary 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
UPDATE_RULE short => What happens to
foreign key when primary is updated:
importedNoAction - do not allow update of primary
key if it has been imported
importedKeyCascade - change imported key to agree
with primary key update
importedKeySetNull - change imported key to NULL if
its primary key has been updated
importedKeySetDefault - change imported key to default values
if its primary key has been updated
importedKeyRestrict - same as importedKeyNoAction
(for ODBC 2.x compatibility)
DELETE_RULE short => What happens to
the foreign key when primary is deleted.
importedKeyNoAction - do not allow delete of primary
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)
importedKeySetDefault - change imported key to default if
its primary key has been deleted
FK_NAME String => foreign key name (may be null)
PK_NAME String => primary key name (may be null)
DEFERRABILITY 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:
primaryCatalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
primarySchema - a schema name pattern; "" retrieves those
without a schema
primaryTable - the table name that exports the key
foreignCatalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
foreignSchema - a schema name pattern; "" retrieves those
without a schema
foreignTable - the table name that imports the key
Returns:
ResultSet - each row is a foreign key column description
Get a description of all the standard SQL types supported by
this database. They are ordered by DATA_TYPE and then by how
closely the data type maps to the corresponding JDBC SQL type.
Each type description has the following columns:
TYPE_NAME String => Type name
DATA_TYPE short => SQL data type from java.sql.Types
PRECISION int => maximum precision
LITERAL_PREFIX String => prefix used to quote a literal
(may be null)
LITERAL_SUFFIX String => suffix used to quote a literal
(may be null)
CREATE_PARAMS String => parameters used in creating
the type (may be null)
NULLABLE short => can you use NULL for this type?
typeNoNulls - does not allow NULL values
typeNullable - allows NULL values
typeNullableUnknown - nullability unknown
CASE_SENSITIVE boolean=> is it case sensitive?
SEARCHABLE short => can you use "WHERE" based on this type:
typePredNone - No support
typePredChar - Only supported with WHERE .. LIKE
typePredBasic - Supported except for WHERE .. LIKE
typeSearchable - Supported for all WHERE ..
UNSIGNED_ATTRIBUTE boolean => is it unsigned?
FIXED_PREC_SCALE boolean => can it be a money value?
AUTO_INCREMENT boolean => can it be used for an
auto-increment value?
LOCAL_TYPE_NAME String => localized version of type name
(may be null)
Get a description of a table's indices and statistics. They are
ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.
Each index column description has the following columns:
TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
NON_UNIQUE boolean => Can index values be non-unique?
false when TYPE is tableIndexStatistic
INDEX_QUALIFIER String => index catalog (may be null);
null when TYPE is tableIndexStatistic
INDEX_NAME String => index name; null when TYPE is
tableIndexStatistic
TYPE short => index type:
tableIndexStatistic - this identifies table statistics that are
returned in conjuction with a table's index descriptions
tableIndexClustered - this is a clustered index
tableIndexHashed - this is a hashed index
tableIndexOther - this is some other style of index
ORDINAL_POSITION short => column sequence number
within index; zero when TYPE is tableIndexStatistic
COLUMN_NAME String => column name; null when TYPE is
tableIndexStatistic
ASC_OR_DESC String => column sort sequence, "A" => ascending,
"D" => descending, may be null if sort sequence is not supported;
null when TYPE is tableIndexStatistic
CARDINALITY int => When TYPE is tableIndexStatistic, then
this is the number of rows in the table; otherwise, it is the
number of unique values in the index.
PAGES int => When TYPE is tableIndexStatisic then
this is the number of pages used for the table, otherwise it
is the number of pages used for the current index.
FILTER_CONDITION String => Filter condition, if any.
(may be null)
Parameters:
catalog - a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria
schema - a schema name pattern; "" retrieves those without a schema
table - a table name
unique - when true, return only indices for unique values;
when false, return indices regardless of whether unique or not
approximate - when true, result is allowed to reflect approximate
or out of data values; when false, results are requested to be
accurate
Returns:
ResultSet - each row is an index column description