DatabaseMetaData interface

The DatabaseMetaData interface provides comprehensive information about the database as a whole.

Some of these methods take String arguments for catalog and schema names. These arguments are ignored by DB2 Everyplace.

Some of the methods here return lists of information in the form of ResultSet objects. 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 throw an SQLException.

java.sql package

public interface DatabaseMetaData

Tabelle 98 lists the fields in the DatabaseMetaData interface that are supported by DB2 Everyplace.

Tabelle 98. DatabaseMetaData fields

Field type Field
static int columnNoNulls Indicates that the column might not allow NULL values.
static int columnNullable Indicates that the column definitely allows NULL values.
static int columnNullableUnknown Indicates that the nullability of columns is unknown.

Tabelle 99 lists the methods in the DatabaseMetaData interface that are supported by DB2 Everyplace.

Tabelle 99. DatabaseMetaData interface methods

Method return value type Method
ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) Gets a description of table columns available in the specified catalog.
Connection getConnection() JDBC 2.0 Retrieves the connection that produced this metadata object.
ResultSet getCrossReference(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) Gets 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_NAME and KEY_SEQ.
String getDatabaseProductName() What is the name of this database product?
String getDatabaseProductVersion() What is the version of this database product?
int getDriverMajorVersion() What is this JDBC driver's major version number?
int getDriverMinorVersion() What is this JDBC driver's minor version number?
String getDriverName() What is the name of this JDBC driver?
String getDriverVersion() What is the version of this JDBC driver?
ResultSet getExportedKeys(String catalog, String schema, String table) Gets a description of the foreign key columns that reference a table's primary key columns (the foreign keys exported by a table).
String getIdentifierQuoteString() What is the string used to quote SQL identifiers? This returns a space " " if identifier quoting is not supported.
ResultSet getImportedKeys(String catalog, String schema, String table) Gets a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table).
int getMaxBinaryLiteralLength() How many hex characters can you have in an inline binary literal?
int getMaxCharLiteralLength() What is the maximum length for a character literal?
int getMaxColumnNameLength() What is the limit of the column name length?
int getMaxColumnsInGroupBy() What is the maximum number of columns in a GROUP BY clause?
int getMaxColumnsInIndex() What is the maximum number of columns allowed in an index?
int getMaxColumnsInOrderBy() What is the maximum number of columns in an ORDER BY clause?
int getMaxColumnsInSelect() What is the maximum number of columns in a SELECT statement?
int getMaxConnections() How many active connections can we have at a time to this database?
int getMaxIndexLength() What is the maximum length of an index (in bytes)?
int getMaxRowSize() What is the maximum length of a single row?
int getMaxStatementLength() What is the maximum length of a SQL statement?
int getMaxStatements() How many active statements can we have open at one time to this database?
int getMaxTableNameLength() What is the maximum length of a table name?
int getMaxTablesInSelect() What is the maximum number of tables in a SELECT statement?
int getMaxUserNameLength() What is the maximum length of a user name?
ResultSet getPrimaryKeys(String catalog, String schema, String table) Gets a description of a table's primary key columns.
String getSearchStringEscape() Gets the string that can be used to escape wildcard characters.
ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) Gets a description of tables available in a catalog.
ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) JDBC 2.0 Gets a description of the user-defined types defined in a particular schema. DB2 Everyplace always returns an empty result set since it does not support UDTs.
String getURL() What is the URL for this database?
String getUserName() What is the user name as it is known to the database?
boolean supportsColumnAliasing() Is column aliasing supported?
boolean supportsFullOuterJoins() Are full nested outer joins supported?
boolean supportsMixedCaseIdentifiers() Does the database treat mixed case unquoted SQL identifiers as case sensitive and as a result store them in mixed case?
boolean supportsMixedCaseQuotedIdentifiers() Does the database treat mixed case quoted SQL identifiers as case sensitive and as a result store them in mixed case?
boolean supportsNonNullableColumns() Can columns be defined as non-nullable?
boolean supportsOrderByUnrelated() Can an "ORDER BY" clause use columns not in the SELECT statement?
boolean supportsOuterJoins() Is some form of outer join supported?
boolean supportsPositionedDelete() Is positioned DELETE supported?
boolean supportsPositionedUpdate() Is positioned UPDATE supported?
boolean supportsResultSetType(int type) JDBC 2.0 Does the database support the given result set type?
boolean supportsSchemasInTableDefinitions() Can a schema name be used in a table definition statement?
boolean supportsTransactions() Are transactions supported? If not, the isolation level is TRANSACTION_NONE.

Zugehörige Tasks

Zugehörige Referenzen