云服务器内容精选

  • javax.sql.DataSource javax.sql.DataSource是数据源接口。 表1 对javax.sql.DataSource接口的支持情况 方法名 返回值类型 支持JDBC 4 getConneciton() Connection Yes getConnection(String username,String password) Connection Yes getLoginTimeout() int Yes getLogWriter() PrintWriter Yes setLoginTimeout(int seconds) void Yes setLogWriter(PrintWriter out) void Yes 父主题: JDBC接口参考
  • java.sql.DatabaseMetaData java.sql.DatabaseMetaData是数据库对象定义接口。 表1 对java.sql.DatabaseMetaData的支持情况 方法名 返回值类型 支持JDBC 4 allProceduresAreCallable() boolean Yes allTablesAreSelectable() boolean Yes autoCommitFailureClosesAllResultSets() boolean Yes dataDefinitionCausesTransactionCommit() boolean Yes dataDefinitionIgnoredInTransactions() boolean Yes deletesAreDetected(int type) boolean Yes doesMaxRowSizeIncludeBlobs() boolean Yes generatedKeyAlwaysReturned() boolean Yes getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) ResultSet Yes getCatalogs() ResultSet Yes getCatalogSeparator() String Yes getCatalogTerm() String Yes getClientInfoProperties() ResultSet Yes getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) ResultSet Yes getConnection() Connection Yes getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) ResultSet Yes getDefaultTransactionIsolation() int Yes getExportedKeys(String catalog, String schema, String table) ResultSet Yes getExtraNameCharacters() String Yes getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) ResultSet Yes getFunctions(String catalog, String schemaPattern, String functionNamePattern) ResultSet Yes getIdentifierQuoteString() String Yes getImportedKeys(String catalog, String schema, String table) ResultSet Yes getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) ResultSet Yes getMaxBinaryLiteralLength() int Yes getMaxCatalogNameLength() int Yes getMaxCharLiteralLength() int Yes getMaxColumnNameLength() int Yes getMaxColumnsInGroupBy() int Yes getMaxColumnsInIndex() int Yes getMaxColumnsInOrderBy() int Yes getMaxColumnsInSelect() int Yes getMaxColumnsInTable() int Yes getMaxConnections() int Yes getMaxCursorNameLength() int Yes getMaxIndexLength() int Yes getMaxLogicalLobSize() default long Yes getMaxProcedureNameLength() int Yes getMaxRowSize() int Yes getMaxSchemaNameLength() int Yes getMaxStatementLength() int Yes getMaxStatements() int Yes getMaxTableNameLength() int Yes getMaxTablesInSelect() int Yes getMaxUserNameLength() int Yes getNumericFunctions() String Yes getPrimaryKeys(String catalog, String schema, String table) ResultSet Yes getPartitionTablePrimaryKeys(String catalog, String schema, String table) ResultSet Yes getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) ResultSet Yes getProcedures(String catalog, String schemaPattern, String procedureNamePattern) ResultSet Yes getProcedureTerm() String Yes getSchemas() ResultSet Yes getSchemas(String catalog, String schemaPattern) ResultSet Yes getSchemaTerm() String Yes getSearchStringEscape() String Yes getSQLKeywords() String Yes getSQLStateType() int Yes getStringFunctions() String Yes getSystemFunctions() String Yes getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) ResultSet Yes getTimeDateFunctions() String Yes getTypeInfo() ResultSet Yes getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) ResultSet Yes getURL() String Yes getVersionColumns(String catalog, String schema, String table) ResultSet Yes insertsAreDetected(int type) boolean Yes locatorsUpdateCopy() boolean Yes othersDeletesAreVisible(int type) boolean Yes othersInsertsAreVisible(int type) boolean Yes othersUpdatesAreVisible(int type) boolean Yes ownDeletesAreVisible(int type) boolean Yes ownInsertsAreVisible(int type) boolean Yes ownUpdatesAreVisible(int type) boolean Yes storesLowerCaseIdentifiers() boolean Yes storesMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes supportsBatchUpdates() boolean Yes supportsCatalogsInDataManipulation() boolean Yes supportsCatalogsInIndexDefinitions() boolean Yes supportsCatalogsInPrivilegeDefinitions() boolean Yes supportsCatalogsInProcedureCalls() boolean Yes supportsCatalogsInTableDefinitions() boolean Yes supportsCorrelatedSubqueries() boolean Yes supportsDataDefinitionAndDataManipulationTransactions() boolean Yes supportsDataManipulationTransactionsOnly() boolean Yes supportsGetGeneratedKeys() boolean Yes supportsMixedCaseIdentifiers() boolean Yes supportsMultipleOpenResults() boolean Yes supportsNamedParameters() boolean Yes supportsOpenCursorsAcrossCommit() boolean Yes supportsOpenCursorsAcrossRollback() boolean Yes supportsOpenStatementsAcrossCommit() boolean Yes supportsOpenStatementsAcrossRollback() boolean Yes supportsPositionedDelete() boolean Yes supportsPositionedUpdate() boolean Yes supportsRefCursors() boolean Yes supportsResultSetConcurrency(int type, int concurrency) boolean Yes supportsResultSetType(int type) boolean Yes supportsSchemasInIndexDefinitions() boolean Yes supportsSchemasInPrivilegeDefinitions() boolean Yes supportsSchemasInProcedureCalls() boolean Yes supportsSchemasInTableDefinitions() boolean Yes supportsSelectForUpdate() boolean Yes supportsStatementPooling() boolean Yes supportsStoredFunctionsUsingCallSyntax() boolean Yes supportsStoredProcedures() boolean Yes supportsSubqueriesInComparisons() boolean Yes supportsSubqueriesInExists() boolean Yes supportsSubqueriesInIns() boolean Yes supportsSubqueriesInQuantifieds() boolean Yes supportsTransactionIsolationLevel(int level) boolean Yes supportsTransactions() boolean Yes supportsUnion() boolean Yes supportsUnionAll() boolean Yes updatesAreDetected(int type) boolean Yes getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) ResultSet Yes getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) ResultSet Yes getTableTypes() ResultSet Yes getUserName() String Yes isReadOnly() boolean Yes nullsAreSortedHigh() boolean Yes nullsAreSortedLow() boolean Yes nullsAreSortedAtStart() boolean Yes nullsAreSortedAtEnd() boolean Yes getDatabaseProductName() String Yes getDatabaseProductVersion() String Yes getDriverName() String Yes getDriverVersion() String Yes getDriverMajorVersion() int Yes getDriverMinorVersion() int Yes usesLocalFiles() boolean Yes usesLocalFilePerTable() boolean Yes supportsMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes storesLowerCaseIdentifiers() boolean Yes supportsMixedCaseQuotedIdentifiers() boolean Yes storesUpperCaseQuotedIdentifiers() boolean Yes storesLowerCaseQuotedIdentifiers() boolean Yes storesMixedCaseQuotedIdentifiers() boolean Yes supportsAlterTableWithAddColumn() boolean Yes supportsAlterTableWithDropColumn() boolean Yes supportsColumnAliasing() boolean Yes nullPlusNonNullIsNull() boolean Yes supportsConvert() boolean Yes supportsConvert(int fromType, int toType) boolean Yes supportsTableCorrelationNames() boolean Yes supportsDifferentTableCorrelationNames() boolean Yes supportsExpressionsInOrderBy() boolean Yes supportsOrderByUnrelated() boolean Yes supportsGroupBy() boolean Yes supportsGroupByUnrelated() boolean Yes supportsGroupByBeyondSelect() boolean Yes supportsLikeEscapeClause() boolean Yes supportsMultipleResultSets() boolean Yes supportsMultipleTransactions() boolean Yes supportsNonNullableColumns() boolean Yes supportsMinimumSQLGrammar() boolean Yes supportsCoreSQLGrammar() boolean Yes supportsExtendedSQLGrammar() boolean Yes supportsANSI92EntryLevelSQL() boolean Yes supportsANSI92IntermediateSQL() boolean Yes supportsANSI92FullSQL() boolean Yes supportsIntegrityEnhancementFacility() boolean Yes supportsOuterJoins() boolean Yes supportsFullOuterJoins() boolean Yes supportsLimitedOuterJoins() boolean Yes isCatalogAtStart() boolean Yes supportsSchemasInDataManipulation() boolean Yes supportsSavepoints() boolean Yes supportsResultSetHoldability(int holdability) boolean Yes getResultSetHoldability() int Yes getDatabaseMajorVersion() int Yes getDatabaseMinorVersion() int Yes getJDBCMajorVersion() int Yes getJDBCMinorVersion() int Yes uppercaseAttributeName为true时,以下接口会将查询结果转为大写,可转换范围与java中的toUpperCase方法一致。 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"); 父主题: JDBC接口参考
  • 常用方法 表1 PGReplicationConnection常用方法 返回值 方法 描述 throws void close() 结束逻辑复制,并释放资源。 SQLException void forceUpdateStatus() 强制将上次接收、刷新和应用的 LSN 状态发送到后端。 SQLException LogSequenceNumber getLastAppliedLSN() 获取上次主机日志回放的LSN。 - LogSequenceNumber getLastFlushedLSN() 获取上次主机刷新的LSN,即当前逻辑解码推进的LSN。 - LogSequenceNumber getLastReceiveLSN() 获取上次接收的LSN。 - boolean isClosed() 复制流是否关闭。 - ByteBuffer read() 从后端读取下一条WAL记录。如果读取不到,该方法阻塞I/O读。 SQLException ByteBuffer readPending() 从后端读取下一条WAL记录。如果读取不到,该方法不阻塞I/O读。 SQLException void setAppliedLSN(LogSequenceNumber applied) 设置应用的LSN。 - void setFlushedLSN(LogSequenceNumber flushed) 设置刷新的LSN,在下次更新时发送至后端,用于推进服务端LSN。 -
  • PGReplicationStream的继承关系 PGReplicationStream是逻辑复制的接口,实现类是V3PGReplicationStream,该类位于org.postgresql.core.v3.replication Package中,该类的声明如下: public class V3PGReplicationStream implements PGReplicationStream
  • javax.naming.Context javax.naming.Context是连接配置的上下文接口。 表1 对javax.naming.Context的支持情况 方法名 返回值类型 支持JDBC 4 bind(Name name, Object obj) void Yes bind(String name, Object obj) void Yes lookup(Name name) Object Yes lookup(String name) Object Yes rebind(Name name, Object obj) void Yes rebind(String name, Object obj) void Yes rename(Name oldName, Name newName) void Yes rename(String oldName, String newName) void Yes unbind(Name name) void Yes unbind(String name) void Yes 父主题: JDBC接口参考
  • java.sql.PreparedStatement java.sql.PreparedStatement是预处理语句接口。 表1 对java.sql.PreparedStatement的支持情况 方法名 返回值类型 支持JDBC 4 clearParameters() void Yes execute() Boolean Yes executeQuery() ResultSet Yes excuteUpdate() int Yes executeLargeUpdate() long No getMetaData() ResultSetMetaData Yes getParameterMetaData() ParameterMetaData Yes setArray(int parameterIndex, Array x) void Yes setAsciiStream(int parameterIndex, InputStream x, int length) void Yes setBinaryStream(int parameterIndex, InputStream x) void Yes setBinaryStream(int parameterIndex, InputStream x, int length) void Yes setBinaryStream(int parameterIndex, InputStream x, long length) void Yes setBlob(int parameterIndex, InputStream inputStream) void Yes setBlob(int parameterIndex, InputStream inputStream, long length) void Yes setBlob(int parameterIndex, Blob x) void Yes setCharacterStream(int parameterIndex, Reader reader) void Yes setCharacterStream(int parameterIndex, Reader reader, int length) void Yes setClob(int parameterIndex, Reader reader) void Yes setClob(int parameterIndex, Reader reader, long length) void Yes setClob(int parameterIndex, Clob x) void Yes setDate(int parameterIndex, Date x, Calendar cal) void Yes setNull(int parameterIndex, int sqlType) void Yes setNull(int parameterIndex, int sqlType, String typeName) void Yes setObject(int parameterIndex, Object x) void Yes setObject(int parameterIndex, Object x, int targetSqlType) void Yes setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) void Yes setSQLXML(int parameterIndex, SQLXML xmlObject) void Yes setTime(int parameterIndex, Time x) void Yes setTime(int parameterIndex, Time x, Calendar cal) void Yes setTimestamp(int parameterIndex, Timestamp x) void Yes setTimestamp(int parameterIndex, Timestamp x, Calendar cal) void Yes setUnicodeStream(int parameterIndex, InputStream x, int length) void Yes setURL(int parameterIndex, URL x) void Yes setBoolean(int parameterIndex, boolean x) void Yes setBigDecimal(int parameterIndex, BigDecimal x) void Yes setByte(int parameterIndex, byte x) void Yes setBytes(int parameterIndex, byte[] x) void Yes setDate(int parameterIndex, Date x) void Yes setDouble(int parameterIndex, double x) void Yes setFloat(int parameterIndex, float x) void Yes setInt(int parameterIndex, int x) void Yes setLong(int parameterIndex, long x) void Yes setShort(int parameterIndex, short x) void Yes setString(int parameterIndex, String x) void Yes setNString(int parameterIndex, String x) void Yes addBatch() void Yes executeBatch() int[] Yes addBatch()、execute()必须在clearBatch()之后才能执行。 调用executeBatch()方法并不会清除batch。用户必须显式使用clearBatch()清除 。 在添加了一个batch的绑定变量后,用户若想重用这些值(再次添加一个batch),无需再次使用set*()方法 。 以下方法是从java.sql.Statement继承而来:close,execute,executeQuery,executeUpdate,getConnection,getResultSet,getUpdateCount,isClosed,setMaxRows,setFetchSize。 executeLargeUpdate()方法必须在JDBC4.2及以上使用。 父主题: JDBC接口参考
  • java.sql.DatabaseMetaData java.sql.DatabaseMetaData是数据库对象定义接口。 表1 对java.sql.DatabaseMetaData的支持情况 方法名 返回值类型 支持JDBC 4 allProceduresAreCallable() boolean Yes allTablesAreSelectable() boolean Yes autoCommitFailureClosesAllResultSets() boolean Yes dataDefinitionCausesTransactionCommit() boolean Yes dataDefinitionIgnoredInTransactions() boolean Yes deletesAreDetected(int type) boolean Yes doesMaxRowSizeIncludeBlobs() boolean Yes generatedKeyAlwaysReturned() boolean Yes getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) ResultSet Yes getCatalogs() ResultSet Yes getCatalogSeparator() String Yes getCatalogTerm() String Yes getClientInfoProperties() ResultSet Yes getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) ResultSet Yes getConnection() Connection Yes getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) ResultSet Yes getDefaultTransactionIsolation() int Yes getExportedKeys(String catalog, String schema, String table) ResultSet Yes getExtraNameCharacters() String Yes getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) ResultSet Yes getFunctions(String catalog, String schemaPattern, String functionNamePattern) ResultSet Yes getIdentifierQuoteString() String Yes getImportedKeys(String catalog, String schema, String table) ResultSet Yes getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) ResultSet Yes getMaxBinaryLiteralLength() int Yes getMaxCatalogNameLength() int Yes getMaxCharLiteralLength() int Yes getMaxColumnNameLength() int Yes getMaxColumnsInGroupBy() int Yes getMaxColumnsInIndex() int Yes getMaxColumnsInOrderBy() int Yes getMaxColumnsInSelect() int Yes getMaxColumnsInTable() int Yes getMaxConnections() int Yes getMaxCursorNameLength() int Yes getMaxIndexLength() int Yes getMaxLogicalLobSize() default long Yes getMaxProcedureNameLength() int Yes getMaxRowSize() int Yes getMaxSchemaNameLength() int Yes getMaxStatementLength() int Yes getMaxStatements() int Yes getMaxTableNameLength() int Yes getMaxTablesInSelect() int Yes getMaxUserNameLength() int Yes getNumericFunctions() String Yes getPrimaryKeys(String catalog, String schema, String table) ResultSet Yes getPartitionTablePrimaryKeys(String catalog, String schema, String table) ResultSet Yes getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) ResultSet Yes getProcedures(String catalog, String schemaPattern, String procedureNamePattern) ResultSet Yes getProcedureTerm() String Yes getSchemas() ResultSet Yes getSchemas(String catalog, String schemaPattern) ResultSet Yes getSchemaTerm() String Yes getSearchStringEscape() String Yes getSQLKeywords() String Yes getSQLStateType() int Yes getStringFunctions() String Yes getSystemFunctions() String Yes getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) ResultSet Yes getTimeDateFunctions() String Yes getTypeInfo() ResultSet Yes getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) ResultSet Yes getURL() String Yes getVersionColumns(String catalog, String schema, String table) ResultSet Yes insertsAreDetected(int type) boolean Yes locatorsUpdateCopy() boolean Yes othersDeletesAreVisible(int type) boolean Yes othersInsertsAreVisible(int type) boolean Yes othersUpdatesAreVisible(int type) boolean Yes ownDeletesAreVisible(int type) boolean Yes ownInsertsAreVisible(int type) boolean Yes ownUpdatesAreVisible(int type) boolean Yes storesLowerCaseIdentifiers() boolean Yes storesMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes supportsBatchUpdates() boolean Yes supportsCatalogsInDataManipulation() boolean Yes supportsCatalogsInIndexDefinitions() boolean Yes supportsCatalogsInPrivilegeDefinitions() boolean Yes supportsCatalogsInProcedureCalls() boolean Yes supportsCatalogsInTableDefinitions() boolean Yes supportsCorrelatedSubqueries() boolean Yes supportsDataDefinitionAndDataManipulationTransactions() boolean Yes supportsDataManipulationTransactionsOnly() boolean Yes supportsGetGeneratedKeys() boolean Yes supportsMixedCaseIdentifiers() boolean Yes supportsMultipleOpenResults() boolean Yes supportsNamedParameters() boolean Yes supportsOpenCursorsAcrossCommit() boolean Yes supportsOpenCursorsAcrossRollback() boolean Yes supportsOpenStatementsAcrossCommit() boolean Yes supportsOpenStatementsAcrossRollback() boolean Yes supportsPositionedDelete() boolean Yes supportsPositionedUpdate() boolean Yes supportsRefCursors() boolean Yes supportsResultSetConcurrency(int type, int concurrency) boolean Yes supportsResultSetType(int type) boolean Yes supportsSchemasInIndexDefinitions() boolean Yes supportsSchemasInPrivilegeDefinitions() boolean Yes supportsSchemasInProcedureCalls() boolean Yes supportsSchemasInTableDefinitions() boolean Yes supportsSelectForUpdate() boolean Yes supportsStatementPooling() boolean Yes supportsStoredFunctionsUsingCallSyntax() boolean Yes supportsStoredProcedures() boolean Yes supportsSubqueriesInComparisons() boolean Yes supportsSubqueriesInExists() boolean Yes supportsSubqueriesInIns() boolean Yes supportsSubqueriesInQuantifieds() boolean Yes supportsTransactionIsolationLevel(int level) boolean Yes supportsTransactions() boolean Yes supportsUnion() boolean Yes supportsUnionAll() boolean Yes updatesAreDetected(int type) boolean Yes getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) ResultSet Yes getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) ResultSet Yes getTableTypes() ResultSet Yes getUserName() String Yes isReadOnly() boolean Yes nullsAreSortedHigh() boolean Yes nullsAreSortedLow() boolean Yes nullsAreSortedAtStart() boolean Yes nullsAreSortedAtEnd() boolean Yes getDatabaseProductName() String Yes getDatabaseProductVersion() String Yes getDriverName() String Yes getDriverVersion() String Yes getDriverMajorVersion() int Yes getDriverMinorVersion() int Yes usesLocalFiles() boolean Yes usesLocalFilePerTable() boolean Yes supportsMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes storesLowerCaseIdentifiers() boolean Yes supportsMixedCaseQuotedIdentifiers() boolean Yes storesUpperCaseQuotedIdentifiers() boolean Yes storesLowerCaseQuotedIdentifiers() boolean Yes storesMixedCaseQuotedIdentifiers() boolean Yes supportsAlterTableWithAddColumn() boolean Yes supportsAlterTableWithDropColumn() boolean Yes supportsColumnAliasing() boolean Yes nullPlusNonNullIsNull() boolean Yes supportsConvert() boolean Yes supportsConvert(int fromType, int toType) boolean Yes supportsTableCorrelationNames() boolean Yes supportsDifferentTableCorrelationNames() boolean Yes supportsExpressionsInOrderBy() boolean Yes supportsOrderByUnrelated() boolean Yes supportsGroupBy() boolean Yes supportsGroupByUnrelated() boolean Yes supportsGroupByBeyondSelect() boolean Yes supportsLikeEscapeClause() boolean Yes supportsMultipleResultSets() boolean Yes supportsMultipleTransactions() boolean Yes supportsNonNullableColumns() boolean Yes supportsMinimumSQLGrammar() boolean Yes supportsCoreSQLGrammar() boolean Yes supportsExtendedSQLGrammar() boolean Yes supportsANSI92EntryLevelSQL() boolean Yes supportsANSI92IntermediateSQL() boolean Yes supportsANSI92FullSQL() boolean Yes supportsIntegrityEnhancementFacility() boolean Yes supportsOuterJoins() boolean Yes supportsFullOuterJoins() boolean Yes supportsLimitedOuterJoins() boolean Yes isCatalogAtStart() boolean Yes supportsSchemasInDataManipulation() boolean Yes supportsSavepoints() boolean Yes supportsResultSetHoldability(int holdability) boolean Yes getResultSetHoldability() int Yes getDatabaseMajorVersion() int Yes getDatabaseMinorVersion() int Yes getJDBCMajorVersion() int Yes getJDBCMinorVersion() int Yes uppercaseAttributeName为true时,以下接口会将查询结果转为大写,可转换范围与java中的toUpperCase方法一致。 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"); 父主题: JDBC接口参考
  • java.sql.DatabaseMetaData java.sql.DatabaseMetaData是数据库对象定义接口。 表1 对java.sql.DatabaseMetaData的支持情况 方法名 返回值类型 支持JDBC 4 allProceduresAreCallable() boolean Yes allTablesAreSelectable() boolean Yes autoCommitFailureClosesAllResultSets() boolean Yes dataDefinitionCausesTransactionCommit() boolean Yes dataDefinitionIgnoredInTransactions() boolean Yes deletesAreDetected(int type) boolean Yes doesMaxRowSizeIncludeBlobs() boolean Yes generatedKeyAlwaysReturned() boolean Yes getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) ResultSet Yes getCatalogs() ResultSet Yes getCatalogSeparator() String Yes getCatalogTerm() String Yes getClientInfoProperties() ResultSet Yes getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) ResultSet Yes getConnection() Connection Yes getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) ResultSet Yes getDefaultTransactionIsolation() int Yes getExportedKeys(String catalog, String schema, String table) ResultSet Yes getExtraNameCharacters() String Yes getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) ResultSet Yes getFunctions(String catalog, String schemaPattern, String functionNamePattern) ResultSet Yes getIdentifierQuoteString() String Yes getImportedKeys(String catalog, String schema, String table) ResultSet Yes getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) ResultSet Yes getMaxBinaryLiteralLength() int Yes getMaxCatalogNameLength() int Yes getMaxCharLiteralLength() int Yes getMaxColumnNameLength() int Yes getMaxColumnsInGroupBy() int Yes getMaxColumnsInIndex() int Yes getMaxColumnsInOrderBy() int Yes getMaxColumnsInSelect() int Yes getMaxColumnsInTable() int Yes getMaxConnections() int Yes getMaxCursorNameLength() int Yes getMaxIndexLength() int Yes getMaxLogicalLobSize() default long Yes getMaxProcedureNameLength() int Yes getMaxRowSize() int Yes getMaxSchemaNameLength() int Yes getMaxStatementLength() int Yes getMaxStatements() int Yes getMaxTableNameLength() int Yes getMaxTablesInSelect() int Yes getMaxUserNameLength() int Yes getNumericFunctions() String Yes getPrimaryKeys(String catalog, String schema, String table) ResultSet Yes getPartitionTablePrimaryKeys(String catalog, String schema, String table) ResultSet Yes getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) ResultSet Yes getProcedures(String catalog, String schemaPattern, String procedureNamePattern) ResultSet Yes getProcedureTerm() String Yes getSchemas() ResultSet Yes getSchemas(String catalog, String schemaPattern) ResultSet Yes getSchemaTerm() String Yes getSearchStringEscape() String Yes getSQLKeywords() String Yes getSQLStateType() int Yes getStringFunctions() String Yes getSystemFunctions() String Yes getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) ResultSet Yes getTimeDateFunctions() String Yes getTypeInfo() ResultSet Yes getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) ResultSet Yes getURL() String Yes getVersionColumns(String catalog, String schema, String table) ResultSet Yes insertsAreDetected(int type) boolean Yes locatorsUpdateCopy() boolean Yes othersDeletesAreVisible(int type) boolean Yes othersInsertsAreVisible(int type) boolean Yes othersUpdatesAreVisible(int type) boolean Yes ownDeletesAreVisible(int type) boolean Yes ownInsertsAreVisible(int type) boolean Yes ownUpdatesAreVisible(int type) boolean Yes storesLowerCaseIdentifiers() boolean Yes storesMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes supportsBatchUpdates() boolean Yes supportsCatalogsInDataManipulation() boolean Yes supportsCatalogsInIndexDefinitions() boolean Yes supportsCatalogsInPrivilegeDefinitions() boolean Yes supportsCatalogsInProcedureCalls() boolean Yes supportsCatalogsInTableDefinitions() boolean Yes supportsCorrelatedSubqueries() boolean Yes supportsDataDefinitionAndDataManipulationTransactions() boolean Yes supportsDataManipulationTransactionsOnly() boolean Yes supportsGetGeneratedKeys() boolean Yes supportsMixedCaseIdentifiers() boolean Yes supportsMultipleOpenResults() boolean Yes supportsNamedParameters() boolean Yes supportsOpenCursorsAcrossCommit() boolean Yes supportsOpenCursorsAcrossRollback() boolean Yes supportsOpenStatementsAcrossCommit() boolean Yes supportsOpenStatementsAcrossRollback() boolean Yes supportsPositionedDelete() boolean Yes supportsPositionedUpdate() boolean Yes supportsRefCursors() boolean Yes supportsResultSetConcurrency(int type, int concurrency) boolean Yes supportsResultSetType(int type) boolean Yes supportsSchemasInIndexDefinitions() boolean Yes supportsSchemasInPrivilegeDefinitions() boolean Yes supportsSchemasInProcedureCalls() boolean Yes supportsSchemasInTableDefinitions() boolean Yes supportsSelectForUpdate() boolean Yes supportsStatementPooling() boolean Yes supportsStoredFunctionsUsingCallSyntax() boolean Yes supportsStoredProcedures() boolean Yes supportsSubqueriesInComparisons() boolean Yes supportsSubqueriesInExists() boolean Yes supportsSubqueriesInIns() boolean Yes supportsSubqueriesInQuantifieds() boolean Yes supportsTransactionIsolationLevel(int level) boolean Yes supportsTransactions() boolean Yes supportsUnion() boolean Yes supportsUnionAll() boolean Yes updatesAreDetected(int type) boolean Yes getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) ResultSet Yes getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) ResultSet Yes getTableTypes() ResultSet Yes getUserName() String Yes isReadOnly() boolean Yes nullsAreSortedHigh() boolean Yes nullsAreSortedLow() boolean Yes nullsAreSortedAtStart() boolean Yes nullsAreSortedAtEnd() boolean Yes getDatabaseProductName() String Yes getDatabaseProductVersion() String Yes getDriverName() String Yes getDriverVersion() String Yes getDriverMajorVersion() int Yes getDriverMinorVersion() int Yes usesLocalFiles() boolean Yes usesLocalFilePerTable() boolean Yes supportsMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes storesLowerCaseIdentifiers() boolean Yes supportsMixedCaseQuotedIdentifiers() boolean Yes storesUpperCaseQuotedIdentifiers() boolean Yes storesLowerCaseQuotedIdentifiers() boolean Yes storesMixedCaseQuotedIdentifiers() boolean Yes supportsAlterTableWithAddColumn() boolean Yes supportsAlterTableWithDropColumn() boolean Yes supportsColumnAliasing() boolean Yes nullPlusNonNullIsNull() boolean Yes supportsConvert() boolean Yes supportsConvert(int fromType, int toType) boolean Yes supportsTableCorrelationNames() boolean Yes supportsDifferentTableCorrelationNames() boolean Yes supportsExpressionsInOrderBy() boolean Yes supportsOrderByUnrelated() boolean Yes supportsGroupBy() boolean Yes supportsGroupByUnrelated() boolean Yes supportsGroupByBeyondSelect() boolean Yes supportsLikeEscapeClause() boolean Yes supportsMultipleResultSets() boolean Yes supportsMultipleTransactions() boolean Yes supportsNonNullableColumns() boolean Yes supportsMinimumSQLGrammar() boolean Yes supportsCoreSQLGrammar() boolean Yes supportsExtendedSQLGrammar() boolean Yes supportsANSI92EntryLevelSQL() boolean Yes supportsANSI92IntermediateSQL() boolean Yes supportsANSI92FullSQL() boolean Yes supportsIntegrityEnhancementFacility() boolean Yes supportsOuterJoins() boolean Yes supportsFullOuterJoins() boolean Yes supportsLimitedOuterJoins() boolean Yes isCatalogAtStart() boolean Yes supportsSchemasInDataManipulation() boolean Yes supportsSavepoints() boolean Yes supportsResultSetHoldability(int holdability) boolean Yes getResultSetHoldability() int Yes getDatabaseMajorVersion() int Yes getDatabaseMinorVersion() int Yes getJDBCMajorVersion() int Yes getJDBCMinorVersion() int Yes uppercaseAttributeName为true时,以下接口会将查询结果转为大写,可转换范围与java中的toUpperCase方法一致。 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"); 父主题: JDBC接口参考
  • java.sql.DatabaseMetaData java.sql.DatabaseMetaData是数据库对象定义接口。 表1 对java.sql.DatabaseMetaData的支持情况 方法名 返回值类型 支持JDBC4 allProceduresAreCallable() boolean Yes allTablesAreSelectable() boolean Yes autoCommitFailureClosesAllResultSets() boolean Yes dataDefinitionCausesTransactionCommit() boolean Yes dataDefinitionIgnoredInTransactions() boolean Yes deletesAreDetected(int type) boolean Yes doesMaxRowSizeIncludeBlobs() boolean Yes generatedKeyAlwaysReturned() boolean Yes getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) ResultSet Yes getCatalogs() ResultSet Yes getCatalogSeparator() String Yes getCatalogTerm() String Yes getClientInfoProperties() ResultSet Yes getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) ResultSet Yes getConnection() Connection Yes getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) ResultSet Yes getDefaultTransactionIsolation() int Yes getExportedKeys(String catalog, String schema, String table) ResultSet Yes getExtraNameCharacters() String Yes getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) ResultSet Yes getFunctions(String catalog, String schemaPattern, String functionNamePattern) ResultSet Yes getIdentifierQuoteString() String Yes getImportedKeys(String catalog, String schema, String table) ResultSet Yes getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) ResultSet Yes getMaxBinaryLiteralLength() int Yes getMaxCatalogNameLength() int Yes getMaxCharLiteralLength() int Yes getMaxColumnNameLength() int Yes getMaxColumnsInGroupBy() int Yes getMaxColumnsInIndex() int Yes getMaxColumnsInOrderBy() int Yes getMaxColumnsInSelect() int Yes getMaxColumnsInTable() int Yes getMaxConnections() int Yes getMaxCursorNameLength() int Yes getMaxIndexLength() int Yes getMaxLogicalLobSize() default long Yes getMaxProcedureNameLength() int Yes getMaxRowSize() int Yes getMaxSchemaNameLength() int Yes getMaxStatementLength() int Yes getMaxStatements() int Yes getMaxTableNameLength() int Yes getMaxTablesInSelect() int Yes getMaxUserNameLength() int Yes getNumericFunctions() String Yes getPrimaryKeys(String catalog, String schema, String table) ResultSet Yes getPartitionTablePrimaryKeys(String catalog, String schema, String table) ResultSet Yes getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) ResultSet Yes getProcedures(String catalog, String schemaPattern, String procedureNamePattern) ResultSet Yes getProcedureTerm() String Yes getSchemas() ResultSet Yes getSchemas(String catalog, String schemaPattern) ResultSet Yes getSchemaTerm() String Yes getSearchStringEscape() String Yes getSQLKeywords() String Yes getSQLStateType() int Yes getStringFunctions() String Yes getSystemFunctions() String Yes getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) ResultSet Yes getTimeDateFunctions() String Yes getTypeInfo() ResultSet Yes getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) ResultSet Yes getURL() String Yes getVersionColumns(String catalog, String schema, String table) ResultSet Yes insertsAreDetected(int type) boolean Yes locatorsUpdateCopy() boolean Yes othersDeletesAreVisible(int type) boolean Yes othersInsertsAreVisible(int type) boolean Yes othersUpdatesAreVisible(int type) boolean Yes ownDeletesAreVisible(int type) boolean Yes ownInsertsAreVisible(int type) boolean Yes ownUpdatesAreVisible(int type) boolean Yes storesLowerCaseIdentifiers() boolean Yes storesMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes supportsBatchUpdates() boolean Yes supportsCatalogsInDataManipulation() boolean Yes supportsCatalogsInIndexDefinitions() boolean Yes supportsCatalogsInPrivilegeDefinitions() boolean Yes supportsCatalogsInProcedureCalls() boolean Yes supportsCatalogsInTableDefinitions() boolean Yes supportsCorrelatedSubqueries() boolean Yes supportsDataDefinitionAndDataManipulationTransactions() boolean Yes supportsDataManipulationTransactionsOnly() boolean Yes supportsGetGeneratedKeys() boolean Yes supportsMixedCaseIdentifiers() boolean Yes supportsMultipleOpenResults() boolean Yes supportsNamedParameters() boolean Yes supportsOpenCursorsAcrossCommit() boolean Yes supportsOpenCursorsAcrossRollback() boolean Yes supportsOpenStatementsAcrossCommit() boolean Yes supportsOpenStatementsAcrossRollback() boolean Yes supportsPositionedDelete() boolean Yes supportsPositionedUpdate() boolean Yes supportsRefCursors() boolean Yes supportsResultSetConcurrency(int type, int concurrency) boolean Yes supportsResultSetType(int type) boolean Yes supportsSchemasInIndexDefinitions() boolean Yes supportsSchemasInPrivilegeDefinitions() boolean Yes supportsSchemasInProcedureCalls() boolean Yes supportsSchemasInTableDefinitions() boolean Yes supportsSelectForUpdate() boolean Yes supportsStatementPooling() boolean Yes supportsStoredFunctionsUsingCallSyntax() boolean Yes supportsStoredProcedures() boolean Yes supportsSubqueriesInComparisons() boolean Yes supportsSubqueriesInExists() boolean Yes supportsSubqueriesInIns() boolean Yes supportsSubqueriesInQuantifieds() boolean Yes supportsTransactionIsolationLevel(int level) boolean Yes supportsTransactions() boolean Yes supportsUnion() boolean Yes supportsUnionAll() boolean Yes updatesAreDetected(int type) boolean Yes getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) ResultSet Yes getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) ResultSet Yes getTableTypes() ResultSet Yes getUserName() String Yes isReadOnly() boolean Yes nullsAreSortedHigh() boolean Yes nullsAreSortedLow() boolean Yes nullsAreSortedAtStart() boolean Yes nullsAreSortedAtEnd() boolean Yes getDatabaseProductName() String Yes getDatabaseProductVersion() String Yes getDriverName() String Yes getDriverVersion() String Yes getDriverMajorVersion() int Yes getDriverMinorVersion() int Yes usesLocalFiles() boolean Yes usesLocalFilePerTable() boolean Yes supportsMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes storesLowerCaseIdentifiers() boolean Yes supportsMixedCaseQuotedIdentifiers() boolean Yes storesUpperCaseQuotedIdentifiers() boolean Yes storesLowerCaseQuotedIdentifiers() boolean Yes storesMixedCaseQuotedIdentifiers() boolean Yes supportsAlterTableWithAddColumn() boolean Yes supportsAlterTableWithDropColumn() boolean Yes supportsColumnAliasing() boolean Yes nullPlusNonNullIsNull() boolean Yes supportsConvert() boolean Yes supportsConvert(int fromType, int toType) boolean Yes supportsTableCorrelationNames() boolean Yes supportsDifferentTableCorrelationNames() boolean Yes supportsExpressionsInOrderBy() boolean Yes supportsOrderByUnrelated() boolean Yes supportsGroupBy() boolean Yes supportsGroupByUnrelated() boolean Yes supportsGroupByBeyondSelect() boolean Yes supportsLikeEscapeClause() boolean Yes supportsMultipleResultSets() boolean Yes supportsMultipleTransactions() boolean Yes supportsNonNullableColumns() boolean Yes supportsMinimumSQLGrammar() boolean Yes supportsCoreSQLGrammar() boolean Yes supportsExtendedSQLGrammar() boolean Yes supportsANSI92EntryLevelSQL() boolean Yes supportsANSI92IntermediateSQL() boolean Yes supportsANSI92FullSQL() boolean Yes supportsIntegrityEnhancementFacility() boolean Yes supportsOuterJoins() boolean Yes supportsFullOuterJoins() boolean Yes supportsLimitedOuterJoins() boolean Yes isCatalogAtStart() boolean Yes supportsSchemasInDataManipulation() boolean Yes supportsSavepoints() boolean Yes supportsResultSetHoldability(int holdability) boolean Yes getResultSetHoldability() int Yes getDatabaseMajorVersion() int Yes getDatabaseMinorVersion() int Yes getJDBCMajorVersion() int Yes getJDBCMinorVersion() int Yes uppercaseAttributeName为true时,以下方法会将查询结果转为大写,可转换范围与java中的toUpperCase方法一致。 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"); 父主题: JDBC接口参考
  • java.sql.DatabaseMetaData java.sql.DatabaseMetaData是数据库对象定义接口。 表1 对java.sql.DatabaseMetaData的支持情况 方法名 返回值类型 支持JDBC4 allProceduresAreCallable() boolean Yes allTablesAreSelectable() boolean Yes autoCommitFailureClosesAllResultSets() boolean Yes dataDefinitionCausesTransactionCommit() boolean Yes dataDefinitionIgnoredInTransactions() boolean Yes deletesAreDetected(int type) boolean Yes doesMaxRowSizeIncludeBlobs() boolean Yes generatedKeyAlwaysReturned() boolean Yes getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) ResultSet Yes getCatalogs() ResultSet Yes getCatalogSeparator() String Yes getCatalogTerm() String Yes getClientInfoProperties() ResultSet Yes getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) ResultSet Yes getConnection() Connection Yes getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) ResultSet Yes getDefaultTransactionIsolation() int Yes getExportedKeys(String catalog, String schema, String table) ResultSet Yes getExtraNameCharacters() String Yes getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) ResultSet Yes getFunctions(String catalog, String schemaPattern, String functionNamePattern) ResultSet Yes getIdentifierQuoteString() String Yes getImportedKeys(String catalog, String schema, String table) ResultSet Yes getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) ResultSet Yes getMaxBinaryLiteralLength() int Yes getMaxCatalogNameLength() int Yes getMaxCharLiteralLength() int Yes getMaxColumnNameLength() int Yes getMaxColumnsInGroupBy() int Yes getMaxColumnsInIndex() int Yes getMaxColumnsInOrderBy() int Yes getMaxColumnsInSelect() int Yes getMaxColumnsInTable() int Yes getMaxConnections() int Yes getMaxCursorNameLength() int Yes getMaxIndexLength() int Yes getMaxLogicalLobSize() default long Yes getMaxProcedureNameLength() int Yes getMaxRowSize() int Yes getMaxSchemaNameLength() int Yes getMaxStatementLength() int Yes getMaxStatements() int Yes getMaxTableNameLength() int Yes getMaxTablesInSelect() int Yes getMaxUserNameLength() int Yes getNumericFunctions() String Yes getPrimaryKeys(String catalog, String schema, String table) ResultSet Yes getPartitionTablePrimaryKeys(String catalog, String schema, String table) ResultSet Yes getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) ResultSet Yes getProcedures(String catalog, String schemaPattern, String procedureNamePattern) ResultSet Yes getProcedureTerm() String Yes getSchemas() ResultSet Yes getSchemas(String catalog, String schemaPattern) ResultSet Yes getSchemaTerm() String Yes getSearchStringEscape() String Yes getSQLKeywords() String Yes getSQLStateType() int Yes getStringFunctions() String Yes getSystemFunctions() String Yes getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) ResultSet Yes getTimeDateFunctions() String Yes getTypeInfo() ResultSet Yes getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) ResultSet Yes getURL() String Yes getVersionColumns(String catalog, String schema, String table) ResultSet Yes insertsAreDetected(int type) boolean Yes locatorsUpdateCopy() boolean Yes othersDeletesAreVisible(int type) boolean Yes othersInsertsAreVisible(int type) boolean Yes othersUpdatesAreVisible(int type) boolean Yes ownDeletesAreVisible(int type) boolean Yes ownInsertsAreVisible(int type) boolean Yes ownUpdatesAreVisible(int type) boolean Yes storesLowerCaseIdentifiers() boolean Yes storesMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes supportsBatchUpdates() boolean Yes supportsCatalogsInDataManipulation() boolean Yes supportsCatalogsInIndexDefinitions() boolean Yes supportsCatalogsInPrivilegeDefinitions() boolean Yes supportsCatalogsInProcedureCalls() boolean Yes supportsCatalogsInTableDefinitions() boolean Yes supportsCorrelatedSubqueries() boolean Yes supportsDataDefinitionAndDataManipulationTransactions() boolean Yes supportsDataManipulationTransactionsOnly() boolean Yes supportsGetGeneratedKeys() boolean Yes supportsMixedCaseIdentifiers() boolean Yes supportsMultipleOpenResults() boolean Yes supportsNamedParameters() boolean Yes supportsOpenCursorsAcrossCommit() boolean Yes supportsOpenCursorsAcrossRollback() boolean Yes supportsOpenStatementsAcrossCommit() boolean Yes supportsOpenStatementsAcrossRollback() boolean Yes supportsPositionedDelete() boolean Yes supportsPositionedUpdate() boolean Yes supportsRefCursors() boolean Yes supportsResultSetConcurrency(int type, int concurrency) boolean Yes supportsResultSetType(int type) boolean Yes supportsSchemasInIndexDefinitions() boolean Yes supportsSchemasInPrivilegeDefinitions() boolean Yes supportsSchemasInProcedureCalls() boolean Yes supportsSchemasInTableDefinitions() boolean Yes supportsSelectForUpdate() boolean Yes supportsStatementPooling() boolean Yes supportsStoredFunctionsUsingCallSyntax() boolean Yes supportsStoredProcedures() boolean Yes supportsSubqueriesInComparisons() boolean Yes supportsSubqueriesInExists() boolean Yes supportsSubqueriesInIns() boolean Yes supportsSubqueriesInQuantifieds() boolean Yes supportsTransactionIsolationLevel(int level) boolean Yes supportsTransactions() boolean Yes supportsUnion() boolean Yes supportsUnionAll() boolean Yes updatesAreDetected(int type) boolean Yes getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) ResultSet Yes getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) ResultSet Yes getTableTypes() ResultSet Yes getUserName() String Yes isReadOnly() boolean Yes nullsAreSortedHigh() boolean Yes nullsAreSortedLow() boolean Yes nullsAreSortedAtStart() boolean Yes nullsAreSortedAtEnd() boolean Yes getDatabaseProductName() String Yes getDatabaseProductVersion() String Yes getDriverName() String Yes getDriverVersion() String Yes getDriverMajorVersion() int Yes getDriverMinorVersion() int Yes usesLocalFiles() boolean Yes usesLocalFilePerTable() boolean Yes supportsMixedCaseIdentifiers() boolean Yes storesUpperCaseIdentifiers() boolean Yes storesLowerCaseIdentifiers() boolean Yes supportsMixedCaseQuotedIdentifiers() boolean Yes storesUpperCaseQuotedIdentifiers() boolean Yes storesLowerCaseQuotedIdentifiers() boolean Yes storesMixedCaseQuotedIdentifiers() boolean Yes supportsAlterTableWithAddColumn() boolean Yes supportsAlterTableWithDropColumn() boolean Yes supportsColumnAliasing() boolean Yes nullPlusNonNullIsNull() boolean Yes supportsConvert() boolean Yes supportsConvert(int fromType, int toType) boolean Yes supportsTableCorrelationNames() boolean Yes supportsDifferentTableCorrelationNames() boolean Yes supportsExpressionsInOrderBy() boolean Yes supportsOrderByUnrelated() boolean Yes supportsGroupBy() boolean Yes supportsGroupByUnrelated() boolean Yes supportsGroupByBeyondSelect() boolean Yes supportsLikeEscapeClause() boolean Yes supportsMultipleResultSets() boolean Yes supportsMultipleTransactions() boolean Yes supportsNonNullableColumns() boolean Yes supportsMinimumSQLGrammar() boolean Yes supportsCoreSQLGrammar() boolean Yes supportsExtendedSQLGrammar() boolean Yes supportsANSI92EntryLevelSQL() boolean Yes supportsANSI92IntermediateSQL() boolean Yes supportsANSI92FullSQL() boolean Yes supportsIntegrityEnhancementFacility() boolean Yes supportsOuterJoins() boolean Yes supportsFullOuterJoins() boolean Yes supportsLimitedOuterJoins() boolean Yes isCatalogAtStart() boolean Yes supportsSchemasInDataManipulation() boolean Yes supportsSavepoints() boolean Yes supportsResultSetHoldability(int holdability) boolean Yes getResultSetHoldability() int Yes getDatabaseMajorVersion() int Yes getDatabaseMinorVersion() int Yes getJDBCMajorVersion() int Yes getJDBCMinorVersion() int Yes getPartitionTablePrimaryKeys(String catalog, String schema, String table)方法用于获取分区表含全局索引的主键列,使用示例如下: PgDatabaseMetaData dbmd = (PgDatabaseMetaData)conn.getMetaData(); dbmd.getPartitionTablePrimaryKeys("catalogName", "schemaName", "tableName"); 父主题: JDBC接口参考
  • java.sql.Connection java.sql.Connection是数据库连接接口。 表1 对java.sql.Connection接口的支持情况 方法名 返回值类型 支持JDBC 4 close() void Yes commit() void Yes createStatement() Statement Yes getAutoCommit() boolean Yes getClientInfo() Properties Yes getClientInfo(String name) String Yes getTransactionIsolation() int Yes isClosed() boolean Yes isReadOnly() boolean Yes prepareStatement(String sql) PreparedStatement Yes rollback() void Yes setAutoCommit(boolean autoCommit) void Yes setClientInfo(Properties properties) void Yes setClientInfo(String name,String value) void Yes 接口内部默认使用自动提交模式,若通过setAutoCommit(false)关闭自动提交,将会导致后面执行的语句都受到显式事务包裹,数据库中不支持事务中执行的语句不能在此模式下执行。 父主题: JDBC接口参考
  • java.sql.Connection java.sql.Connection是数据库连接接口。 表1 对java.sql.Connection接口的支持情况 方法名 返回值类型 支持JDBC 4 close() void Yes commit() void Yes createStatement() Statement Yes getAutoCommit() boolean Yes getClientInfo() Properties Yes getClientInfo(String name) String Yes getTransactionIsolation() int Yes isClosed() boolean Yes isReadOnly() boolean Yes prepareStatement(String sql) PreparedStatement Yes rollback() void Yes setAutoCommit(boolean autoCommit) void Yes setClientInfo(Properties properties) void Yes setClientInfo(String name,String value) void Yes 接口内部默认使用自动提交模式,若通过setAutoCommit(false)关闭自动提交,将会导致后面执行的语句都受到显式事务包裹,数据库中不支持事务中执行的语句不能在此模式下执行。 父主题: JDBC接口参考
  • javax.sql.PooledConnection javax.sql.PooledConnection是由连接池创建的连接接口。 表1 对javax.sql.PooledConnection的支持情况 方法名 返回值类型 支持JDBC 4 addConnectionEventListener (ConnectionEventListener listener) void Yes close() void Yes getConnection() Connection Yes removeConnectionEventListener (ConnectionEventListener listener) void Yes addStatementEventListener (StatementEventListener listener) void Yes removeStatementEventListener (StatementEventListener listener) void Yes 父主题: JDBC接口参考
  • java.sql.Statement java.sql.Statement是SQL语句接口。 表1 对java.sql.Statement的支持情况 方法名 返回值类型 支持JDBC 4 close() void Yes execute(String sql) boolean Yes executeQuery(String sql) ResultSet Yes executeUpdate(String sql) int Yes getConnection() Connection Yes getResultSet() ResultSet Yes getQueryTimeout() int Yes getUpdateCount() int Yes isClosed() boolean Yes setQueryTimeout(int seconds) void Yes setFetchSize(int rows) void Yes cancel() void Yes 通过setFetchSize可以减少结果集在客户端的内存占用情况。它的原理是通过将结果集打包成游标,然后分段处理,所以会加大数据库与客户端的通信量,会有性能损耗。 由于数据库游标是事务内有效,所以,在设置setFetchSize的同时,需要将连接设置为非自动提交模式,setAutoCommit(false)。同时在业务数据需要持久化到数据库中时,在连接上执行提交操作。 父主题: JDBC接口参考
  • javax.sql.DataSource javax.sql.DataSource是数据源接口。 表1 对javax.sql.DataSource接口的支持情况 方法名 返回值类型 支持JDBC 4 getConneciton() Connection Yes getConnection(String username,String password) Connection Yes getLoginTimeout() int Yes getLogWriter() PrintWriter Yes setLoginTimeout(int seconds) void Yes setLogWriter(PrintWriter out) void Yes 父主题: JDBC接口参考