public class ConnectionHolder40 extends ConnectionHolder
ConnectionHolder.ConnectionType| Modifier and Type | Field and Description |
|---|---|
protected Properties |
defaultClientInfo |
protected boolean |
jdbc30Connection |
protected static StringManager |
localStrings |
active, con, isClosed, mc, sm, statementTimeout, statementTimeoutEnabled, valid, wrappedAlreadyTRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE| Constructor and Description |
|---|
ConnectionHolder40(Connection con,
ManagedConnectionImpl mc,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo,
boolean jdbc30Connection)
Connection wrapper given to application program
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Executor executor)
Abort operation to mark the connection internally as a bad connection
for removal and to close the connection.
|
void |
close()
Closes the logical connection.
Cleans up client specific details |
Array |
createArrayOf(String typeName,
Object[] elements)
Factory method for creating Array objects.
|
Blob |
createBlob()
Constructs an object that implements the
Blob interface. |
Clob |
createClob()
Constructs an object that implements the
Clob interface. |
NClob |
createNClob()
Constructs an object that implements the
NClob interface. |
SQLXML |
createSQLXML()
Constructs an object that implements the
SQLXML interface. |
Struct |
createStruct(String typeName,
Object[] attributes)
Factory method for creating Struct objects.
|
Properties |
getClientInfo()
Returns a list containing the name and current value of each client info
property supported by the driver.
|
String |
getClientInfo(String name)
Returns the value of the client info property specified by name.
|
int |
getNetworkTimeout() |
String |
getSchema() |
protected void |
init()
cache the default client info which can will set back during close()
as this connection may be re-used by connection pool of application server |
boolean |
isValid(int timeout)
Returns true if the connection has not been closed and is still valid.
|
boolean |
isWrapperFor(Class<?> iface)
Returns true if this either implements the interface argument or is directly or indirectly a wrapper
for an object that does.
|
void |
setClientInfo(Properties properties)
Sets the value of the connection's client info properties.
|
void |
setClientInfo(String name,
String value)
Sets the value of the client info property specified by name to the
value specified by value.
|
void |
setNetworkTimeout(Executor executorObj,
int milliseconds) |
void |
setSchema(String schema) |
<T> T |
unwrap(Class<T> iface)
Returns an object that implements the given interface to allow access to
non-standard methods, or standard methods not exposed by the proxy.
|
associateConnection, checkValidity, clearWarnings, commit, createStatement, createStatement, createStatement, dissociateConnection, getAutoCommit, getCatalog, getConnection, getConnectionType, getHoldability, getManagedConnection, getMetaData, getMethodExecutor, getTransactionIsolation, getTypeMap, getWarnings, invalidate, isClosed, isReadOnly, isWrapped, jdbcPreInvoke, nativeSQL, performLazyAssociation, performLazyEnlistment, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setActive, setAutoCommit, setCatalog, setClosed, setConnectionType, setHoldability, setLazyAssociatableConnectionManager, setLazyEnlistableConnectionManager, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap, wrappedprotected static final StringManager localStrings
protected Properties defaultClientInfo
protected boolean jdbc30Connection
public ConnectionHolder40(Connection con, ManagedConnectionImpl mc, javax.resource.spi.ConnectionRequestInfo cxRequestInfo, boolean jdbc30Connection)
con - Connection that is wrappedmc - ManagedConnectioncxRequestInfo - Connection Request Informationprotected void init()
public Clob createClob() throws SQLException
Clob interface. The object
returned initially contains no data. The setAsciiStream,
setCharacterStream and setString methods of
the Clob interface may be used to add data to the Clob.Clob interfaceSQLException - if an object that implements the
Clob interface can not be constructed, this method is
called on a closed connection or a database access error occurs.SQLFeatureNotSupportedException - if the JDBC driver does not support
this data typepublic Blob createBlob() throws SQLException
Blob interface. The object
returned initially contains no data. The setBinaryStream and
setBytes methods of the Blob interface may be used to add data to
the Blob.Blob interfaceSQLException - if an object that implements the
Blob interface can not be constructed, this method is
called on a closed connection or a database access error occurs.SQLFeatureNotSupportedException - if the JDBC driver does not support
this data typepublic NClob createNClob() throws SQLException
NClob interface. The object
returned initially contains no data. The setAsciiStream,
setCharacterStream and setString methods of the NClob interface may
be used to add data to the NClob.NClob interfaceSQLException - if an object that implements the
NClob interface can not be constructed, this method is
called on a closed connection or a database access error occurs.SQLFeatureNotSupportedException - if the JDBC driver does not support
this data typepublic SQLXML createSQLXML() throws SQLException
SQLXML interface. The object
returned initially contains no data. The createXmlStreamWriter object and
setString method of the SQLXML interface may be used to add data to the SQLXML
object.SQLXML interfaceSQLException - if an object that implements the SQLXML interface can not
be constructed, this method is
called on a closed connection or a database access error occurs.SQLFeatureNotSupportedException - if the JDBC driver does not support
this data typepublic boolean isValid(int timeout)
throws SQLException
timeout - - The time in seconds to wait for the database operation
used to validate the connection to complete. If
the timeout period expires before the operation
completes, this method returns false. A value of
0 indicates a timeout is not applied to the
database operation.
SQLException - if the value supplied for timeout
is less then 0DatabaseMetaData.getClientInfoProperties()public void setClientInfo(String name, String value) throws SQLClientInfoException
DatabaseMetaData.getClientInfoProperties
method to determine the client info properties supported by the driver
and the maximum length that may be specified for each property.
The driver stores the value specified in a suitable location in the
database. For example in a special register, session parameter, or
system table column. For efficiency the driver may defer setting the
value in the database until the next time a statement is executed or
prepared. Other than storing the client information in the appropriate
place in the database, these methods shall not alter the behavior of
the connection in anyway. The values supplied to these methods are
used for accounting, diagnostics and debugging purposes only.
The driver shall generate a warning if the client info name specified
is not recognized by the driver.
If the value specified to this method is greater than the maximum
length for the property the driver may either truncate the value and
generate a warning or generate a SQLClientInfoException. If the driver
generates a SQLClientInfoException, the value specified was not set on the
connection.
The following are standard client info properties. Drivers are not
required to support these properties however if the driver supports a
client info property that can be described by one of the standard
properties, the standard property name should be used.
name - The name of the client info property to setvalue - The value to set the client info property to. If the
value is null, the current value of the specified
property is cleared.
SQLClientInfoException - if the database server returns an error while
setting the client info value on the database server or this method
is called on a closed connection
public void setClientInfo(Properties properties) throws SQLClientInfoException
Properties object contains the names and values of the client info
properties to be set. The set of client info properties contained in
the properties list replaces the current set of client info properties
on the connection. If a property that is currently set on the
connection is not present in the properties list, that property is
cleared. Specifying an empty properties list will clear all of the
properties on the connection. See setClientInfo (String, String) for
more information.
If an error occurs in setting any of the client info properties, a
SQLClientInfoException is thrown. The SQLClientInfoException
contains information indicating which client info properties were not set.
The state of the client information is unknown because
some databases do not allow multiple client info properties to be set
atomically. For those databases, one or more properties may have been
set before the error occurred.
properties - the list of client info properties to set
SQLClientInfoException - if the database server returns an error while
setting the clientInfo values on the database server or this method
is called on a closed connection
setClientInfo(String, String)public String getClientInfo(String name) throws SQLException
DatabaseMetaData.getClientInfoProperties
method to determine the client info properties supported by the driver.
name - The name of the client info property to retrieve
SQLException - if the database server returns an error when
fetching the client info value from the database
or this method is called on a closed connection
DatabaseMetaData.getClientInfoProperties()public Properties getClientInfo() throws SQLException
Properties object that contains the name and current value of
each of the client info properties supported by the driver.
SQLException - if the database server returns an error when
fetching the client info values from the database
or this method is called on a closed connection
public Array createArrayOf(String typeName, Object[] elements) throws SQLException
typeName - the SQL name of the type the elements of the array map to. The typeName is a
database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This
is the value returned by Array.getBaseTypeNameelements - the elements that populate the returned objectSQLException - if a database error occurs, the typeName is null or this method is called on a closed connectionSQLFeatureNotSupportedException - if the JDBC driver does not support this data typepublic Struct createStruct(String typeName, Object[] attributes) throws SQLException
typeName - the SQL type name of the SQL structured type that this Struct
object maps to. The typeName is the name of a user-defined type that
has been defined for this database. It is the value returned by
Struct.getSQLTypeName.attributes - the attributes that populate the returned objectSQLException - if a database error occurs, the typeName is null or this method is called on a closed connectionSQLFeatureNotSupportedException - if the JDBC driver does not support this data typepublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap recursively on the wrapped object
or a proxy for that result. If the receiver is not a
wrapper and does not implement the interface, then an SQLException is thrown.iface - A Class defining an interface that the result must implement.SQLException - If no object found that implements the interfacepublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor on the wrapped
object. If this does not implement the interface and is not a wrapper, return false.
This method should be implemented as a low-cost operation compared to unwrap so that
callers can use this method to avoid expensive unwrap calls that may fail. If this method
returns true then calling unwrap with the same argument should succeed.iface - a Class defining an interface.SQLException - if an error occurs while determining whether this is a wrapper
for an object with the given interface.public void close()
throws SQLException
close in interface AutoCloseableclose in interface Connectionclose in class ConnectionHolderSQLException - In case of a database error.public void setSchema(String schema) throws SQLException
SQLExceptionpublic String getSchema() throws SQLException
SQLExceptionpublic void setNetworkTimeout(Executor executorObj, int milliseconds) throws SQLException
SQLExceptionpublic int getNetworkTimeout()
throws SQLException
SQLExceptionpublic void abort(Executor executor) throws SQLException
executor - SQLExceptionCopyright © 2019. All rights reserved.