public class JdbcConnection extends TraceObject implements Connection, JdbcConnectionBackwardsCompat, CastDataProvider
Thread safety: the connection is thread-safe, because access is synchronized. Different statements from the same connection may try to execute their commands in parallel, but they will be executed sequentially. If real concurrent execution of these commands is needed, different connections should be used.
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQLXML, STATEMENT, trace, XA_DATA_SOURCE, XID| 构造器和说明 |
|---|
JdbcConnection(JdbcConnection clone)
INTERNAL
|
JdbcConnection(Session session,
String user,
String url)
INTERNAL
|
JdbcConnection(String url,
Properties info,
String user,
Object password,
boolean forbidCreation)
INTERNAL
the session closable object does not leak as Eclipse warns - due to the
CloseWatcher.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
abort(Executor executor)
[Not supported]
|
protected void |
checkClosed()
INTERNAL.
|
void |
clearWarnings()
Clears all warnings.
|
void |
close()
Closes this connection.
|
void |
commit()
Commits the current transaction.
|
Array |
createArrayOf(String typeName,
Object[] elements)
Create a new Array object.
|
Blob |
createBlob()
Create a new empty Blob object.
|
Clob |
createClob()
Create a new empty Clob object.
|
NClob |
createNClob()
Create a new empty NClob object.
|
SQLXML |
createSQLXML()
Create a new SQLXML object with no data.
|
Statement |
createStatement()
Creates a new statement.
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Creates a statement with the specified result set type and concurrency.
|
Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates a statement with the specified result set type, concurrency, and
holdability.
|
Struct |
createStruct(String typeName,
Object[] attributes)
[Not supported] Create a new empty Struct object.
|
ValueTimestampTimeZone |
currentTimestamp()
Returns the current timestamp with maximum resolution.
|
TimeZoneProvider |
currentTimeZone()
Returns the current time zone.
|
boolean |
getAutoCommit()
Gets the current setting for auto commit.
|
String |
getCatalog()
Gets the current catalog name.
|
Properties |
getClientInfo()
Get the client properties.
|
String |
getClientInfo(String name)
Get a client property.
|
int |
getHoldability()
Returns the current result set holdability.
|
JavaObjectSerializer |
getJavaObjectSerializer()
Returns the custom Java object serializer, or
null. |
DatabaseMetaData |
getMetaData()
Gets the database meta data for this database.
|
Mode |
getMode()
Returns the database mode.
|
int |
getNetworkTimeout()
[Not supported]
|
String |
getSchema()
Retrieves this current schema name for this connection.
|
Session |
getSession()
INTERNAL
|
Session.StaticSettings |
getStaticSettings()
INTERNAL
|
int |
getTransactionIsolation()
Returns the current transaction isolation level.
|
Map<String,Class<?>> |
getTypeMap()
Gets the type map.
|
SQLWarning |
getWarnings()
Gets the first warning reported by calls on this object.
|
boolean |
isClosed()
Returns true if this connection has been closed.
|
boolean |
isReadOnly()
Returns true if the database is read-only.
|
boolean |
isValid(int timeout)
Returns true if this connection is still valid.
|
boolean |
isWrapperFor(Class<?> iface)
Checks if unwrap can return an object of this class.
|
String |
nativeSQL(String sql)
Translates a SQL statement into the database grammar.
|
CallableStatement |
prepareCall(String sql)
Creates a new callable statement.
|
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency)
Creates a callable statement with the specified result set type and
concurrency.
|
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates a callable statement with the specified result set type,
concurrency, and holdability.
|
PreparedStatement |
prepareStatement(String sql)
Creates a new prepared statement.
|
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys)
Creates a new prepared statement.
|
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes)
Creates a new prepared statement.
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency)
Creates a prepared statement with the specified result set type and
concurrency.
|
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Creates a prepared statement with the specified result set type,
concurrency, and holdability.
|
PreparedStatement |
prepareStatement(String sql,
String[] columnNames)
Creates a new prepared statement.
|
void |
releaseSavepoint(Savepoint savepoint)
Releases a savepoint.
|
void |
rollback()
Rolls back the current transaction.
|
void |
rollback(Savepoint savepoint)
Rolls back to a savepoint.
|
void |
setAutoCommit(boolean autoCommit)
Switches auto commit on or off.
|
void |
setCatalog(String catalog)
Set the default catalog name.
|
void |
setClientInfo(Properties properties)
Set the client properties.
|
void |
setClientInfo(String name,
String value)
Set a client property.
|
void |
setHoldability(int holdability)
Changes the current result set holdability.
|
void |
setNetworkTimeout(Executor executor,
int milliseconds)
[Not supported]
|
void |
setReadOnly(boolean readOnly)
According to the JDBC specs, this setting is only a hint to the database
to enable optimizations - it does not cause writes to be prohibited.
|
Savepoint |
setSavepoint()
Creates a new unnamed savepoint.
|
Savepoint |
setSavepoint(String name)
Creates a new named savepoint.
|
void |
setSchema(String schema)
Sets the given schema name to access.
|
void |
setTransactionIsolation(int level)
Changes the current transaction isolation level.
|
void |
setTypeMap(Map<String,Class<?>> map)
[Partially supported] Sets the type map.
|
String |
toString()
INTERNAL
|
<T> T |
unwrap(Class<T> iface)
Return an object of this class if possible.
|
boolean |
zeroBasedEnums()
Returns are ENUM values 0-based.
|
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupportedpublic JdbcConnection(String url, Properties info, String user, Object password, boolean forbidCreation) throws SQLException
url - of this connectioninfo - of this connectionuser - of this connectionpassword - for the userforbidCreation - whether database creation is forbiddenSQLException - on failurepublic JdbcConnection(JdbcConnection clone)
clone - connection to clonepublic Statement createStatement() throws SQLException
createStatement 在接口中 ConnectionSQLException - if the connection is closedpublic Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
createStatement 在接口中 ConnectionresultSetType - the result set type (ResultSet.TYPE_*)resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)SQLException - if the connection is closed or the result set type
or concurrency are not supportedpublic Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
createStatement 在接口中 ConnectionresultSetType - the result set type (ResultSet.TYPE_*)resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)resultSetHoldability - the holdability (ResultSet.HOLD* / CLOSE*)SQLException - if the connection is closed or the result set type,
concurrency, or holdability are not supportedpublic PreparedStatement prepareStatement(String sql) throws SQLException
prepareStatement 在接口中 Connectionsql - the SQL statementSQLException - if the connection is closedpublic DatabaseMetaData getMetaData() throws SQLException
getMetaData 在接口中 ConnectionSQLException - if the connection is closedpublic Session getSession()
public void close()
throws SQLException
close 在接口中 AutoCloseableclose 在接口中 ConnectionSQLExceptionpublic void setAutoCommit(boolean autoCommit)
throws SQLException
setAutoCommit 在接口中 ConnectionautoCommit - true for auto commit on, false for offSQLException - if the connection is closedpublic boolean getAutoCommit()
throws SQLException
getAutoCommit 在接口中 ConnectionSQLException - if the connection is closedpublic void commit()
throws SQLException
commit 在接口中 ConnectionSQLException - if the connection is closedpublic void rollback()
throws SQLException
rollback 在接口中 ConnectionSQLException - if the connection is closedpublic boolean isClosed()
throws SQLException
isClosed 在接口中 ConnectionSQLExceptionpublic String nativeSQL(String sql) throws SQLException
nativeSQL 在接口中 Connectionsql - the SQL statement with or without JDBC escape sequencesSQLException - if the connection is closedpublic void setReadOnly(boolean readOnly)
throws SQLException
setReadOnly 在接口中 ConnectionreadOnly - ignoredSQLException - if the connection is closedpublic boolean isReadOnly()
throws SQLException
isReadOnly 在接口中 ConnectionSQLException - if the connection is closedpublic void setCatalog(String catalog) throws SQLException
setCatalog 在接口中 Connectioncatalog - ignoredSQLException - if the connection is closedpublic String getCatalog() throws SQLException
getCatalog 在接口中 ConnectionSQLException - if the connection is closedpublic SQLWarning getWarnings() throws SQLException
getWarnings 在接口中 ConnectionSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings 在接口中 ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareStatement 在接口中 Connectionsql - the SQL statementresultSetType - the result set type (ResultSet.TYPE_*)resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)SQLException - if the connection is closed or the result set type
or concurrency are not supportedpublic void setTransactionIsolation(int level)
throws SQLException
setTransactionIsolation 在接口中 Connectionlevel - the new transaction isolation level:
Connection.TRANSACTION_READ_UNCOMMITTED,
Connection.TRANSACTION_READ_COMMITTED,
Connection.TRANSACTION_REPEATABLE_READ,
6 (SNAPSHOT), or
Connection.TRANSACTION_SERIALIZABLESQLException - if the connection is closed or the isolation level
is not validpublic int getTransactionIsolation()
throws SQLException
getTransactionIsolation 在接口中 ConnectionSQLException - if the connection is closedpublic void setHoldability(int holdability)
throws SQLException
setHoldability 在接口中 Connectionholdability - ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT;SQLException - if the connection is closed or the holdability is
not supportedpublic int getHoldability()
throws SQLException
getHoldability 在接口中 ConnectionSQLException - if the connection is closedpublic Map<String,Class<?>> getTypeMap() throws SQLException
getTypeMap 在接口中 ConnectionSQLException - if the connection is closedpublic void setTypeMap(Map<String,Class<?>> map) throws SQLException
setTypeMap 在接口中 ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql) throws SQLException
prepareCall 在接口中 Connectionsql - the SQL statementSQLException - if the connection is closed or the statement is not
validpublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareCall 在接口中 Connectionsql - the SQL statementresultSetType - the result set type (ResultSet.TYPE_*)resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)SQLException - if the connection is closed or the result set type
or concurrency are not supportedpublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareCall 在接口中 Connectionsql - the SQL statementresultSetType - the result set type (ResultSet.TYPE_*)resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)resultSetHoldability - the holdability (ResultSet.HOLD* / CLOSE*)SQLException - if the connection is closed or the result set type,
concurrency, or holdability are not supportedpublic Savepoint setSavepoint() throws SQLException
setSavepoint 在接口中 ConnectionSQLExceptionpublic Savepoint setSavepoint(String name) throws SQLException
setSavepoint 在接口中 Connectionname - the savepoint nameSQLExceptionpublic void rollback(Savepoint savepoint) throws SQLException
rollback 在接口中 Connectionsavepoint - the savepointSQLExceptionpublic void releaseSavepoint(Savepoint savepoint) throws SQLException
releaseSavepoint 在接口中 Connectionsavepoint - the savepoint to releaseSQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareStatement 在接口中 Connectionsql - the SQL statementresultSetType - the result set type (ResultSet.TYPE_*)resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)resultSetHoldability - the holdability (ResultSet.HOLD* / CLOSE*)SQLException - if the connection is closed or the result set type,
concurrency, or holdability are not supportedpublic PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
prepareStatement 在接口中 Connectionsql - the SQL statementautoGeneratedKeys - Statement.RETURN_GENERATED_KEYS if generated keys should
be available for retrieval, Statement.NO_GENERATED_KEYS if
generated keys should not be availableSQLException - if the connection is closedpublic PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
prepareStatement 在接口中 Connectionsql - the SQL statementcolumnIndexes - an array of column indexes indicating the columns with generated
keys that should be returned from the inserted rowSQLException - if the connection is closedpublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
prepareStatement 在接口中 Connectionsql - the SQL statementcolumnNames - an array of column names indicating the columns with generated
keys that should be returned from the inserted rowSQLException - if the connection is closedprotected void checkClosed()
DbException - if the connection or session is closedpublic Clob createClob() throws SQLException
createClob 在接口中 ConnectionSQLExceptionpublic Blob createBlob() throws SQLException
createBlob 在接口中 ConnectionSQLExceptionpublic NClob createNClob() throws SQLException
createNClob 在接口中 ConnectionSQLExceptionpublic SQLXML createSQLXML() throws SQLException
createSQLXML 在接口中 ConnectionSQLExceptionpublic Array createArrayOf(String typeName, Object[] elements) throws SQLException
createArrayOf 在接口中 ConnectiontypeName - the type nameelements - the valuesSQLExceptionpublic Struct createStruct(String typeName, Object[] attributes) throws SQLException
createStruct 在接口中 ConnectionSQLExceptionpublic boolean isValid(int timeout)
isValid 在接口中 Connectiontimeout - the number of seconds to wait for the database to respond
(ignored)public void setClientInfo(String name, String value) throws SQLClientInfoException
setClientInfo 在接口中 Connectionname - the name of the propertyvalue - the valueSQLClientInfoExceptionpublic void setClientInfo(Properties properties) throws SQLClientInfoException
setClientInfo 在接口中 Connectionproperties - the properties (ignored)SQLClientInfoExceptionpublic Properties getClientInfo() throws SQLException
getClientInfo 在接口中 ConnectionSQLExceptionpublic String getClientInfo(String name) throws SQLException
getClientInfo 在接口中 Connectionname - the client info nameSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap 在接口中 Wrapperiface - the classSQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor 在接口中 Wrapperiface - the classSQLExceptionpublic void setSchema(String schema) throws SQLException
setSchema 在接口中 Connectionschema - the schema nameSQLExceptionpublic String getSchema() throws SQLException
getSchema 在接口中 ConnectionSQLExceptionpublic void abort(Executor executor)
abort 在接口中 Connectionexecutor - the executor used by this methodpublic void setNetworkTimeout(Executor executor, int milliseconds)
setNetworkTimeout 在接口中 Connectionexecutor - the executor used by this methodmilliseconds - the TCP connection timeoutpublic int getNetworkTimeout()
getNetworkTimeout 在接口中 Connectionpublic Mode getMode()
CastDataProvidergetMode 在接口中 CastDataProviderpublic Session.StaticSettings getStaticSettings()
public ValueTimestampTimeZone currentTimestamp()
CastDataProvidercurrentTimestamp 在接口中 CastDataProviderpublic TimeZoneProvider currentTimeZone()
CastDataProvidercurrentTimeZone 在接口中 CastDataProviderpublic JavaObjectSerializer getJavaObjectSerializer()
CastDataProvidernull.getJavaObjectSerializer 在接口中 CastDataProvidernullpublic boolean zeroBasedEnums()
CastDataProviderzeroBasedEnums 在接口中 CastDataProviderCopyright © 2022. All rights reserved.