java.sql.DatabaseMetaData
java.sql.DatabaseMetaData是数据库对象定义接口。
方法名 |
返回值类型 |
支持JDBC4 |
支持计划外ALT |
---|---|---|---|
allProceduresAreCallable() |
boolean |
Yes |
Yes |
allTablesAreSelectable() |
boolean |
Yes |
Yes |
autoCommitFailureClosesAllResultSets() |
boolean |
Yes |
Yes |
dataDefinitionCausesTransactionCommit() |
boolean |
Yes |
Yes |
dataDefinitionIgnoredInTransactions() |
boolean |
Yes |
Yes |
deletesAreDetected(int type) |
boolean |
Yes |
Yes |
doesMaxRowSizeIncludeBlobs() |
boolean |
Yes |
Yes |
generatedKeyAlwaysReturned() |
boolean |
Yes |
Yes |
getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) |
ResultSet |
Yes |
Yes |
getCatalogs() |
ResultSet |
Yes |
Yes |
getCatalogSeparator() |
String |
Yes |
Yes |
getCatalogTerm() |
String |
Yes |
Yes |
getClientInfoProperties() |
ResultSet |
Yes |
Yes |
getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) |
ResultSet |
Yes |
Yes |
getConnection() |
Connection |
Yes |
Yes |
getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) |
ResultSet |
Yes |
Yes |
getDefaultTransactionIsolation() |
int |
Yes |
Yes |
getExportedKeys(String catalog, String schema, String table) |
ResultSet |
Yes |
Yes |
getExtraNameCharacters() |
String |
Yes |
Yes |
getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) |
ResultSet |
Yes |
Yes |
getFunctions(String catalog, String schemaPattern, String functionNamePattern) |
ResultSet |
Yes |
Yes |
getIdentifierQuoteString() |
String |
Yes |
Yes |
getImportedKeys(String catalog, String schema, String table) |
ResultSet |
Yes |
Yes |
getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) |
ResultSet |
Yes |
Yes |
getMaxBinaryLiteralLength() |
int |
Yes |
Yes |
getMaxCatalogNameLength() |
int |
Yes |
Yes |
getMaxCharLiteralLength() |
int |
Yes |
Yes |
getMaxColumnNameLength() |
int |
Yes |
Yes |
getMaxColumnsInGroupBy() |
int |
Yes |
Yes |
getMaxColumnsInIndex() |
int |
Yes |
Yes |
getMaxColumnsInOrderBy() |
int |
Yes |
Yes |
getMaxColumnsInSelect() |
int |
Yes |
Yes |
getMaxColumnsInTable() |
int |
Yes |
Yes |
getMaxConnections() |
int |
Yes |
Yes |
getMaxCursorNameLength() |
int |
Yes |
Yes |
getMaxIndexLength() |
int |
Yes |
Yes |
getMaxLogicalLobSize() |
default long |
Yes |
Yes |
getMaxProcedureNameLength() |
int |
Yes |
Yes |
getMaxRowSize() |
int |
Yes |
Yes |
getMaxSchemaNameLength() |
int |
Yes |
Yes |
getMaxStatementLength() |
int |
Yes |
Yes |
getMaxStatements() |
int |
Yes |
Yes |
getMaxTableNameLength() |
int |
Yes |
Yes |
getMaxTablesInSelect() |
int |
Yes |
Yes |
getMaxUserNameLength() |
int |
Yes |
Yes |
getNumericFunctions() |
String |
Yes |
Yes |
getPrimaryKeys(String catalog, String schema, String table) |
ResultSet |
Yes |
Yes |
getPartitionTablePrimaryKeys(String catalog, String schema, String table) |
ResultSet |
Yes |
Yes |
getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) |
ResultSet |
Yes |
Yes |
getProcedures(String catalog, String schemaPattern, String procedureNamePattern) |
ResultSet |
Yes |
Yes |
getProcedureTerm() |
String |
Yes |
Yes |
getSchemas() |
ResultSet |
Yes |
Yes |
getSchemas(String catalog, String schemaPattern) |
ResultSet |
Yes |
Yes |
getSchemaTerm() |
String |
Yes |
Yes |
getSearchStringEscape() |
String |
Yes |
Yes |
getSQLKeywords() |
String |
Yes |
Yes |
getSQLStateType() |
int |
Yes |
Yes |
getStringFunctions() |
String |
Yes |
Yes |
getSystemFunctions() |
String |
Yes |
Yes |
getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) |
ResultSet |
Yes |
Yes |
getTimeDateFunctions() |
String |
Yes |
Yes |
getTypeInfo() |
ResultSet |
Yes |
Yes |
getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) |
ResultSet |
Yes |
Yes |
getURL() |
String |
Yes |
Yes |
getVersionColumns(String catalog, String schema, String table) |
ResultSet |
Yes |
Yes |
insertsAreDetected(int type) |
boolean |
Yes |
Yes |
locatorsUpdateCopy() |
boolean |
Yes |
Yes |
othersDeletesAreVisible(int type) |
boolean |
Yes |
Yes |
othersInsertsAreVisible(int type) |
boolean |
Yes |
Yes |
othersUpdatesAreVisible(int type) |
boolean |
Yes |
Yes |
ownDeletesAreVisible(int type) |
boolean |
Yes |
Yes |
ownInsertsAreVisible(int type) |
boolean |
Yes |
Yes |
ownUpdatesAreVisible(int type) |
boolean |
Yes |
Yes |
storesLowerCaseIdentifiers() |
boolean |
Yes |
Yes |
storesMixedCaseIdentifiers() |
boolean |
Yes |
Yes |
storesUpperCaseIdentifiers() |
boolean |
Yes |
Yes |
supportsBatchUpdates() |
boolean |
Yes |
Yes |
supportsCatalogsInDataManipulation() |
boolean |
Yes |
Yes |
supportsCatalogsInIndexDefinitions() |
boolean |
Yes |
Yes |
supportsCatalogsInPrivilegeDefinitions() |
boolean |
Yes |
Yes |
supportsCatalogsInProcedureCalls() |
boolean |
Yes |
Yes |
supportsCatalogsInTableDefinitions() |
boolean |
Yes |
Yes |
supportsCorrelatedSubqueries() |
boolean |
Yes |
Yes |
supportsDataDefinitionAndDataManipulationTransactions() |
boolean |
Yes |
Yes |
supportsDataManipulationTransactionsOnly() |
boolean |
Yes |
Yes |
supportsGetGeneratedKeys() |
boolean |
Yes |
Yes |
supportsMixedCaseIdentifiers() |
boolean |
Yes |
Yes |
supportsMultipleOpenResults() |
boolean |
Yes |
Yes |
supportsNamedParameters() |
boolean |
Yes |
Yes |
supportsOpenCursorsAcrossCommit() |
boolean |
Yes |
Yes |
supportsOpenCursorsAcrossRollback() |
boolean |
Yes |
Yes |
supportsOpenStatementsAcrossCommit() |
boolean |
Yes |
Yes |
supportsOpenStatementsAcrossRollback() |
boolean |
Yes |
Yes |
supportsPositionedDelete() |
boolean |
Yes |
Yes |
supportsPositionedUpdate() |
boolean |
Yes |
Yes |
supportsRefCursors() |
boolean |
Yes |
Yes |
supportsResultSetConcurrency(int type, int concurrency) |
boolean |
Yes |
Yes |
supportsResultSetType(int type) |
boolean |
Yes |
Yes |
supportsSchemasInIndexDefinitions() |
boolean |
Yes |
Yes |
supportsSchemasInPrivilegeDefinitions() |
boolean |
Yes |
Yes |
supportsSchemasInProcedureCalls() |
boolean |
Yes |
Yes |
supportsSchemasInTableDefinitions() |
boolean |
Yes |
Yes |
supportsSelectForUpdate() |
boolean |
Yes |
Yes |
supportsStatementPooling() |
boolean |
Yes |
Yes |
supportsStoredFunctionsUsingCallSyntax() |
boolean |
Yes |
Yes |
supportsStoredProcedures() |
boolean |
Yes |
Yes |
supportsSubqueriesInComparisons() |
boolean |
Yes |
Yes |
supportsSubqueriesInExists() |
boolean |
Yes |
Yes |
supportsSubqueriesInIns() |
boolean |
Yes |
Yes |
supportsSubqueriesInQuantifieds() |
boolean |
Yes |
Yes |
supportsTransactionIsolationLevel(int level) |
boolean |
Yes |
Yes |
supportsTransactions() |
boolean |
Yes |
Yes |
supportsUnion() |
boolean |
Yes |
Yes |
supportsUnionAll() |
boolean |
Yes |
Yes |
updatesAreDetected(int type) |
boolean |
Yes |
Yes |
getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) |
ResultSet |
Yes |
Yes |
getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) |
ResultSet |
Yes |
Yes |
getTableTypes() |
ResultSet |
Yes |
Yes |
getUserName() |
String |
Yes |
Yes |
isReadOnly() |
boolean |
Yes |
Yes |
nullsAreSortedHigh() |
boolean |
Yes |
Yes |
nullsAreSortedLow() |
boolean |
Yes |
Yes |
nullsAreSortedAtStart() |
boolean |
Yes |
Yes |
nullsAreSortedAtEnd() |
boolean |
Yes |
Yes |
getDatabaseProductName() |
String |
Yes |
Yes |
getDatabaseProductVersion() |
String |
Yes |
Yes |
getDriverName() |
String |
Yes |
Yes |
getDriverVersion() |
String |
Yes |
Yes |
getDriverMajorVersion() |
int |
Yes |
Yes |
getDriverMinorVersion() |
int |
Yes |
Yes |
usesLocalFiles() |
boolean |
Yes |
Yes |
usesLocalFilePerTable() |
boolean |
Yes |
Yes |
supportsMixedCaseIdentifiers() |
boolean |
Yes |
Yes |
storesUpperCaseIdentifiers() |
boolean |
Yes |
Yes |
storesLowerCaseIdentifiers() |
boolean |
Yes |
Yes |
supportsMixedCaseQuotedIdentifiers() |
boolean |
Yes |
Yes |
storesUpperCaseQuotedIdentifiers() |
boolean |
Yes |
Yes |
storesLowerCaseQuotedIdentifiers() |
boolean |
Yes |
Yes |
storesMixedCaseQuotedIdentifiers() |
boolean |
Yes |
Yes |
supportsAlterTableWithAddColumn() |
boolean |
Yes |
Yes |
supportsAlterTableWithDropColumn() |
boolean |
Yes |
Yes |
supportsColumnAliasing() |
boolean |
Yes |
Yes |
nullPlusNonNullIsNull() |
boolean |
Yes |
Yes |
supportsConvert() |
boolean |
Yes |
Yes |
supportsConvert(int fromType, int toType) |
boolean |
Yes |
Yes |
supportsTableCorrelationNames() |
boolean |
Yes |
Yes |
supportsDifferentTableCorrelationNames() |
boolean |
Yes |
Yes |
supportsExpressionsInOrderBy() |
boolean |
Yes |
Yes |
supportsOrderByUnrelated() |
boolean |
Yes |
Yes |
supportsGroupBy() |
boolean |
Yes |
Yes |
supportsGroupByUnrelated() |
boolean |
Yes |
Yes |
supportsGroupByBeyondSelect() |
boolean |
Yes |
Yes |
supportsLikeEscapeClause() |
boolean |
Yes |
Yes |
supportsMultipleResultSets() |
boolean |
Yes |
Yes |
supportsMultipleTransactions() |
boolean |
Yes |
Yes |
supportsNonNullableColumns() |
boolean |
Yes |
Yes |
supportsMinimumSQLGrammar() |
boolean |
Yes |
Yes |
supportsCoreSQLGrammar() |
boolean |
Yes |
Yes |
supportsExtendedSQLGrammar() |
boolean |
Yes |
Yes |
supportsANSI92EntryLevelSQL() |
boolean |
Yes |
Yes |
supportsANSI92IntermediateSQL() |
boolean |
Yes |
Yes |
supportsANSI92FullSQL() |
boolean |
Yes |
Yes |
supportsIntegrityEnhancementFacility() |
boolean |
Yes |
Yes |
supportsOuterJoins() |
boolean |
Yes |
Yes |
supportsFullOuterJoins() |
boolean |
Yes |
Yes |
supportsLimitedOuterJoins() |
boolean |
Yes |
Yes |
isCatalogAtStart() |
boolean |
Yes |
Yes |
supportsSchemasInDataManipulation() |
boolean |
Yes |
Yes |
supportsSavepoints() |
boolean |
Yes |
Yes |
supportsResultSetHoldability(int holdability) |
boolean |
Yes |
Yes |
getResultSetHoldability() |
int |
Yes |
Yes |
getDatabaseMajorVersion() |
int |
Yes |
Yes |
getDatabaseMinorVersion() |
int |
Yes |
Yes |
getJDBCMajorVersion() |
int |
Yes |
Yes |
getJDBCMinorVersion() |
int |
Yes |
Yes |
- public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern)
- public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern)
- public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
- public ResultSet getSchemas(String catalog, String schemaPattern)
- public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
- public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern)
- public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern)
- public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable)
- public ResultSet getPrimaryKeys(String catalog, String schema, String table)
- protected ResultSet getImportedExportedKeys(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable)
- public ResultSet getIndexInfo(String catalog, String schema, String tableName, boolean unique, boolean approximate)
- public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types)
- public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern)
getPartitionTablePrimaryKeys(String catalog, String schema, String table)方法用于获取分区表含全局索引的主键列,使用示例如下:
PgDatabaseMetaData dbmd = (PgDatabaseMetaData)conn.getMetaData(); dbmd.getPartitionTablePrimaryKeys("catalogName", "schemaName", "tableName");