Package org.apache.derby.client.net
Class NetConnection
java.lang.Object
org.apache.derby.client.am.ClientConnection
org.apache.derby.client.net.NetConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
,ConnectionCallbackInterface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private boolean
(package private) byte[]
protected int
private char[]
private String
private PreparedStatement
Prepared statement that is used each time isValid() is called on this connection.private static final MessageUtil
protected NetAgent
private final ClientPooledConnection
private ByteBuffer
private byte[]
private int
private byte[]
protected int
protected int
protected int
private byte[]
protected int
protected int
private int
(package private) int
private byte[]
(package private) String
(package private) String
protected int
protected int
protected int
protected NetXAResource
Fields inherited from class org.apache.derby.client.am.ClientConnection
agent_, autoCommit_, commBufferSize_, databaseMetaData_, databaseName_, dataSource_, encryptionManager_, inUnitOfWork_, isXAConnection_, open_, portNumber_, productID_, resetConnectionAtFirstSql_, serverNameIP_, user_, XA_T0_NOT_ASSOCIATED, XA_T1_ASSOCIATED, xaHostVersion_
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorsConstructorDescriptionNetConnection
(LogWriter logWriter, int driverManagerLoginTimeout, String serverName, int portNumber, String databaseName, Properties properties) NetConnection
(LogWriter logWriter, String user, String password, BasicClientDataSource40 dataSource, int rmId, boolean isXAConn) NetConnection
(LogWriter logWriter, String user, String password, BasicClientDataSource40 dataSource, int rmId, boolean isXAConn, ClientPooledConnection cpc) This constructor is called from the ClientPooledConnection object to enable the NetConnection to passthis
on to the associated prepared statement object thus enabling the prepared statement object to in turn raise the statement events to the ClientPooledConnection object -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Check if the connection can be closed when there are uncommitted operations.protected boolean
private void
private void
checkPasswordLength
(String password) private void
checkSecmgrForSecmecSupport
(int securityMechanism) private void
private void
checkUserLength
(String user) private void
checkUserPassword
(String user, String password) void
close()
Close the connection and release its resources.private void
completeReset
(boolean isDeferredReset) protected void
private void
private void
createArrayOf
(String typeName, Object[] elements) createStruct
(String typeName, Object[] attributes) protected boolean
private byte[]
encryptedPasswordForEUSRIDPWD
(String password) private byte[]
encryptedPasswordForUSRENCPWD
(String password) private byte[]
private char[]
flipBits
(char[] array) private void
flowConnect
(String password, int securityMechanism) private void
private void
flowEUSRIDPWDconnect
(String password) private void
flowEUSRPWDDTAconnect
(String password) private void
flowKeyExchange
(int securityMechanism, byte[] publicKey) private boolean
flowReconnect
(String password, int securityMechanism) private void
flowSecurityCheckAndAccessRdb
(int securityMechanism, String user, String password, byte[] encryptedUserid, byte[] encryptedPassword) private void
flowSeedExchange
(int securityMechanism, byte[] sourceSeed) private void
private void
flowServerAttributesAndKeyExchange
(int securityMechanism, byte[] publicKey) private void
private void
flowUSRENCPWDconnect
(String password) private void
private void
flowUSRIDPWDconnect
(String password) private void
flowUSRSSBPWDconnect
(String password) The User ID and Strong Password Substitute mechanism (USRSSBPWD) authenticates the user like the user ID and password mechanism, but the password does not flow.int
getAGENT()
getClientInfo
always returns an emptyProperties
object since Derby doesn't support ClientInfoProperties.getClientInfo
(String name) getClientInfo
always returns anull String
since Derby doesn't support ClientInfoProperties.int
private String
(package private) Xid[]
int
getRDB()
int
int
int
int
getSQLAM()
int
byte[]
int
getXAMGR()
private void
handleLoginTimeout
(Throwable original) Handle socket timeouts during connection attemptsprivate void
initialize
(String password, BasicClientDataSource40 dataSource, boolean isXAConn) private void
private void
final boolean
protected boolean
boolean
isOpen()
Returns if a transaction is in processboolean
isValid
(int timeout) Checks if the connection has not been closed and is still valid.boolean
isWrapperFor
(Class<?> interfaces) Returns false unlessinterfaces
is implementedprivate SqlException
mapSecchkcd
(int secchkcd) protected void
protected Agent
newAgent_
(LogWriter logWriter, int loginTimeout, String serverName, int portNumber, int clientSSLMode) protected ClientCallableStatement
newCallableStatement_
(String sql, int type, int concurrency, int holdability) protected ClientDatabaseMetaData
protected ClientPreparedStatement
newPositionedUpdatePreparedStatement_
(String sql, Section section) protected ClientPreparedStatement
newPreparedStatement_
(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) newSectionManager
(Agent agent) protected ClientStatement
newStatement_
(int type, int concurrency, int holdability) private byte[]
passwordSubstituteForUSRSSBPWD
(String password) (package private) void
rdbAccessed
(int svrcod, String prdid, boolean crrtknReceived, byte[] crrtkn) private void
readAllConnectCommandsChained
(int securityMechanism) void
(package private) void
void
void
void
void
void
private void
private void
readServerAttributesAndKeyExchange
(int securityMechanism) void
protected void
Invokes readCommit on NetXAConnectionprotected void
Invokes writeRollback on NetXAConnectionprotected void
protected void
resetCallableStatement_
(ClientCallableStatement cs, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) private void
resetNetConnection
(LogWriter logWriter) protected void
resetPreparedStatement_
(ClientPreparedStatement ps, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) protected void
resetStatement_
(ClientStatement statement, int type, int concurrency, int holdability) (package private) void
securityCheckComplete
(int svrcod, int secchkcd) final boolean
protected final boolean
final boolean
protected final boolean
Checks whether the server supports locators for large objects.(package private) final boolean
Check whether the server has full support for the QRYCLSIMP parameter in OPNQRY.protected final boolean
Return true if the server supports nanoseconds in timestampsprotected final boolean
Check whether the server supports UDTsprotected final boolean
Check whether the server supports the UTF-8 Ccsid Manager(package private) void
setAccessSecurityData
(int secchkcd, int desiredSecmec, int[] secmecList, boolean sectknReceived, byte[] sectkn) void
setClientInfo
(String name, String value) setClientInfo
will always throw aSQLClientInfoException
since Derby does not support any properties.void
setClientInfo
(Properties properties) setClientInfo
will throw aSQLClientInfoException
unless theproperties
parameter is empty, since Derby does not support any properties.void
setConnectionNull
(boolean connectionNull) private void
setDeferredResetPassword
(String password) void
setIndoubtTransactions
(List<Xid> indoubtTransactions) void
setInputStream
(InputStream inputStream) void
setOutputStream
(OutputStream outputStream) (package private) void
setServerAttributeData
(String srvclsnm, String srvrlslv) protected final boolean
Check whether the server supports session data caching<T> T
Returnsthis
if this class implements the interfaceboolean
private void
writeAllConnectCommandsChained
(int securityMechanism, String user, String password) void
(package private) void
void
void
void
void
void
private void
writeSecurityCheckAndAccessRdb
(int securityMechanism, String user, String password, byte[] encryptedUserid, byte[] encryptedPassword) private void
writeServerAttributesAndKeyExchange
(int securityMechanism, byte[] publicKey) void
writeTransactionStart
(ClientStatement statement) protected void
Invokes write commit on NetXAConnectionprotected void
Invokes writeRollback on NetXAConnectionprotected void
writeXATransactionStart
(ClientStatement statement) Methods inherited from class org.apache.derby.client.am.ClientConnection
abort, beginAborting, checkForClosedConnection, clearWarnings, closeResources, commit, completeAbnormalUnitOfWork, completeAbnormalUnitOfWork, completeChainBreakingDisconnect, completeConnect, completeInitialPiggyBackIsolation, completeInitialPiggyBackSchema, completeLocalCommit, completeLocalRollback, completePiggyBackIsolation, completePiggyBackSchema, completeReset, completeSqlca, createBlob, createClob, createStatement, createStatement, createStatement, finalize, flowAutoCommit, flowRollback, getAutoCommit, getCatalog, getCurrentSchemaName, getHoldability, getMetaData, getNetworkTimeout, getSchema, getServerVersion, getTransactionID, getTransactionIsolation, getTransactionIsolationX, getTypeMap, getWarnings, getXAState, isAborting, isClosed, isClosedX, isPhysicalConnClosed, isReadOnly, isXAConnection, lightReset, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, reset, resetConnection, resetPrepareCall, resetPrepareStatement, resetStatement, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, setXAState, transactionInProgress
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
msgutil
-
netAgent_
-
pooledConnection_
-
closeStatementsOnClose
private final boolean closeStatementsOnClose -
targetAgent_
protected int targetAgent_ -
targetCmntcpip_
protected int targetCmntcpip_ -
targetRdb_
protected int targetRdb_ -
targetSecmgr_
int targetSecmgr_ -
targetCmnappc_
protected int targetCmnappc_ -
targetXamgr_
protected int targetXamgr_ -
targetSyncptmgr_
protected int targetSyncptmgr_ -
targetRsyncmgr_
protected int targetRsyncmgr_ -
targetUnicodemgr_
protected int targetUnicodemgr_ -
extnam_
-
targetSrvclsnm_
String targetSrvclsnm_ -
targetSrvrlslv_
String targetSrvrlslv_ -
publicKey_
private transient byte[] publicKey_ -
targetPublicKey_
private transient byte[] targetPublicKey_ -
sourceSeed_
private transient byte[] sourceSeed_ -
targetSeed_
private transient byte[] targetSeed_ -
prddta_
-
crrtkn_
byte[] crrtkn_ -
targetSecmec_
private int targetSecmec_ -
securityMechanism_
private int securityMechanism_ -
deferredResetPassword_
private transient char[] deferredResetPassword_ -
connectionNull
private boolean connectionNull -
xares_
-
indoubtTransactions_
-
currXACallInfoOffset_
protected int currXACallInfoOffset_ -
isValidStmt
Prepared statement that is used each time isValid() is called on this connection. The statement is created the first time isValid is called and closed when the connection is closed (by the close call).
-
-
Constructor Details
-
NetConnection
NetConnection(LogWriter logWriter, int driverManagerLoginTimeout, String serverName, int portNumber, String databaseName, Properties properties) throws SqlException - Throws:
SqlException
-
NetConnection
NetConnection(LogWriter logWriter, String user, String password, BasicClientDataSource40 dataSource, int rmId, boolean isXAConn) throws SqlException - Throws:
SqlException
-
NetConnection
NetConnection(LogWriter logWriter, String user, String password, BasicClientDataSource40 dataSource, int rmId, boolean isXAConn, ClientPooledConnection cpc) throws SqlException This constructor is called from the ClientPooledConnection object to enable the NetConnection to passthis
on to the associated prepared statement object thus enabling the prepared statement object to in turn raise the statement events to the ClientPooledConnection object- Parameters:
logWriter
- LogWriter object associated with this connectionuser
- user id for this connectionpassword
- password for this connectiondataSource
- The DataSource object passed from the PooledConnection object from which this constructor was calledrmId
- The Resource manager ID for XA ConnectionsisXAConn
- true if this is a XA connectioncpc
- The ClientPooledConnection object from which this NetConnection constructor was called. This is used to pass StatementEvents back to the pooledConnection object- Throws:
SqlException
-
-
Method Details
-
setDeferredResetPassword
-
getDeferredResetPassword
-
initialize
private void initialize(String password, BasicClientDataSource40 dataSource, boolean isXAConn) throws SqlException - Throws:
SqlException
-
resetNetConnection
- Throws:
SqlException
-
reset_
- Specified by:
reset_
in classClientConnection
- Throws:
SqlException
-
completeReset
- Throws:
SqlException
-
flowConnect
- Throws:
SqlException
-
flowSimpleConnect
- Throws:
SqlException
-
handleLoginTimeout
Handle socket timeouts during connection attempts- Throws:
SqlException
-
flowReconnect
- Throws:
SqlException
-
flowUSRIDPWDconnect
- Throws:
SqlException
-
flowUSRIDONLconnect
- Throws:
SqlException
-
flowUSRENCPWDconnect
- Throws:
SqlException
-
flowEUSRIDPWDconnect
- Throws:
SqlException
-
flowEUSRIDDTAconnect
- Throws:
SqlException
-
flowEUSRPWDDTAconnect
- Throws:
SqlException
-
flowUSRSSBPWDconnect
The User ID and Strong Password Substitute mechanism (USRSSBPWD) authenticates the user like the user ID and password mechanism, but the password does not flow. A password substitute is generated instead using the SHA-1 algorithm, and is sent to the application server. The application server generates a password substitute using the same algorithm and compares it with the application requester's password substitute. If equal, the user is authenticated. The SECTKN parameter is used to flow the client and server encryption seeds on the ACCSEC and ACCSECRD commands. More information in DRDA, V3, Volume 3 standard - PWDSSB (page 650)- Throws:
SqlException
-
flowServerAttributes
- Throws:
SqlException
-
flowKeyExchange
- Throws:
SqlException
-
flowSeedExchange
- Throws:
SqlException
-
flowServerAttributesAndKeyExchange
private void flowServerAttributesAndKeyExchange(int securityMechanism, byte[] publicKey) throws SqlException - Throws:
SqlException
-
flowSecurityCheckAndAccessRdb
private void flowSecurityCheckAndAccessRdb(int securityMechanism, String user, String password, byte[] encryptedUserid, byte[] encryptedPassword) throws SqlException - Throws:
SqlException
-
writeAllConnectCommandsChained
private void writeAllConnectCommandsChained(int securityMechanism, String user, String password) throws SqlException - Throws:
SqlException
-
readAllConnectCommandsChained
- Throws:
SqlException
-
writeServerAttributesAndKeyExchange
private void writeServerAttributesAndKeyExchange(int securityMechanism, byte[] publicKey) throws SqlException - Throws:
SqlException
-
readServerAttributesAndKeyExchange
- Throws:
SqlException
-
writeSecurityCheckAndAccessRdb
private void writeSecurityCheckAndAccessRdb(int securityMechanism, String user, String password, byte[] encryptedUserid, byte[] encryptedPassword) throws SqlException - Throws:
SqlException
-
readSecurityCheckAndAccessRdb
- Throws:
SqlException
-
writeDeferredReset
- Throws:
SqlException
-
readDeferredReset
- Throws:
SqlException
-
setServerAttributeData
-
setAccessSecurityData
void setAccessSecurityData(int secchkcd, int desiredSecmec, int[] secmecList, boolean sectknReceived, byte[] sectkn) throws DisconnectException - Throws:
DisconnectException
-
securityCheckComplete
void securityCheckComplete(int svrcod, int secchkcd) -
rdbAccessed
-
newAgent_
protected Agent newAgent_(LogWriter logWriter, int loginTimeout, String serverName, int portNumber, int clientSSLMode) throws SqlException - Specified by:
newAgent_
in classClientConnection
- Throws:
SqlException
-
newStatement_
protected ClientStatement newStatement_(int type, int concurrency, int holdability) throws SqlException - Specified by:
newStatement_
in classClientConnection
- Throws:
SqlException
-
resetStatement_
protected void resetStatement_(ClientStatement statement, int type, int concurrency, int holdability) throws SqlException - Specified by:
resetStatement_
in classClientConnection
- Throws:
SqlException
-
newPositionedUpdatePreparedStatement_
protected ClientPreparedStatement newPositionedUpdatePreparedStatement_(String sql, Section section) throws SqlException - Specified by:
newPositionedUpdatePreparedStatement_
in classClientConnection
- Throws:
SqlException
-
newPreparedStatement_
protected ClientPreparedStatement newPreparedStatement_(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Specified by:
newPreparedStatement_
in classClientConnection
- Throws:
SqlException
-
resetPreparedStatement_
protected void resetPreparedStatement_(ClientPreparedStatement ps, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Specified by:
resetPreparedStatement_
in classClientConnection
- Throws:
SqlException
-
newCallableStatement_
protected ClientCallableStatement newCallableStatement_(String sql, int type, int concurrency, int holdability) throws SqlException - Specified by:
newCallableStatement_
in classClientConnection
- Throws:
SqlException
-
resetCallableStatement_
protected void resetCallableStatement_(ClientCallableStatement cs, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SqlException - Specified by:
resetCallableStatement_
in classClientConnection
- Throws:
SqlException
-
newDatabaseMetaData_
- Specified by:
newDatabaseMetaData_
in classClientConnection
-
checkDatabaseName
- Throws:
SqlException
-
checkUserLength
- Throws:
SqlException
-
checkPasswordLength
- Throws:
SqlException
-
checkUser
- Throws:
SqlException
-
checkUserPassword
- Throws:
SqlException
-
checkSecmgrForSecmecSupport
- Throws:
SqlException
-
mapSecchkcd
-
constructCrrtkn
- Throws:
SqlException
-
constructExtnam
- Throws:
SqlException
-
constructPrddta
- Throws:
SqlException
-
initializePublicKeyForEncryption
- Throws:
SqlException
-
initializeClientSeed
- Throws:
SqlException
-
encryptedPasswordForUSRENCPWD
- Throws:
SqlException
-
encryptedUseridForEUSRIDPWD
- Throws:
SqlException
-
encryptedPasswordForEUSRIDPWD
- Throws:
SqlException
-
passwordSubstituteForUSRSSBPWD
- Throws:
SqlException
-
getSQLAM
public int getSQLAM() -
getAGENT
public int getAGENT() -
getCMNTCPIP
public int getCMNTCPIP() -
getRDB
public int getRDB() -
getSECMGR
public int getSECMGR() -
getXAMGR
public int getXAMGR() -
getSYNCPTMGR
public int getSYNCPTMGR() -
getRSYNCMGR
public int getRSYNCMGR() -
flipBits
private char[] flipBits(char[] array) -
writeCommitSubstitute_
- Specified by:
writeCommitSubstitute_
in classClientConnection
- Throws:
SqlException
-
readCommitSubstitute_
- Specified by:
readCommitSubstitute_
in classClientConnection
- Throws:
SqlException
-
writeLocalXAStart_
- Specified by:
writeLocalXAStart_
in classClientConnection
- Throws:
SqlException
-
readLocalXAStart_
- Specified by:
readLocalXAStart_
in classClientConnection
- Throws:
SqlException
-
writeLocalXACommit_
- Specified by:
writeLocalXACommit_
in classClientConnection
- Throws:
SqlException
-
readLocalXACommit_
- Specified by:
readLocalXACommit_
in classClientConnection
- Throws:
SqlException
-
writeLocalXARollback_
- Specified by:
writeLocalXARollback_
in classClientConnection
- Throws:
SqlException
-
readLocalXARollback_
- Specified by:
readLocalXARollback_
in classClientConnection
- Throws:
SqlException
-
writeLocalCommit_
- Specified by:
writeLocalCommit_
in classClientConnection
- Throws:
SqlException
-
readLocalCommit_
- Specified by:
readLocalCommit_
in classClientConnection
- Throws:
SqlException
-
writeLocalRollback_
- Specified by:
writeLocalRollback_
in classClientConnection
- Throws:
SqlException
-
readLocalRollback_
- Specified by:
readLocalRollback_
in classClientConnection
- Throws:
SqlException
-
markClosed_
protected void markClosed_()- Specified by:
markClosed_
in classClientConnection
-
isGlobalPending_
protected boolean isGlobalPending_()- Specified by:
isGlobalPending_
in classClientConnection
-
doCloseStatementsOnClose_
protected boolean doCloseStatementsOnClose_()- Specified by:
doCloseStatementsOnClose_
in classClientConnection
-
allowCloseInUOW_
protected boolean allowCloseInUOW_()Check if the connection can be closed when there are uncommitted operations.- Specified by:
allowCloseInUOW_
in classClientConnection
- Returns:
- if this connection can be closed when it has uncommitted
operations,
true
; otherwise,false
-
allowLocalCommitRollback_
protected boolean allowLocalCommitRollback_()- Specified by:
allowLocalCommitRollback_
in classClientConnection
-
setInputStream
-
setOutputStream
-
getInputStream
-
getOutputStream
-
writeTransactionStart
- Overrides:
writeTransactionStart
in classClientConnection
- Throws:
SqlException
-
readTransactionStart
- Overrides:
readTransactionStart
in classClientConnection
- Throws:
SqlException
-
setIndoubtTransactions
-
getIndoubtTransactionIds
Xid[] getIndoubtTransactionIds() -
newSectionManager
- Specified by:
newSectionManager
in classClientConnection
-
willAutoCommitGenerateFlow
public boolean willAutoCommitGenerateFlow()- Overrides:
willAutoCommitGenerateFlow
in classClientConnection
-
getSecurityMechanism
public int getSecurityMechanism() -
getEncryptionManager
-
getTargetPublicKey
public byte[] getTargetPublicKey() -
getProductID
-
isConnectionNull
public final boolean isConnectionNull()- Returns:
- Returns the connectionNull.
-
setConnectionNull
public void setConnectionNull(boolean connectionNull) - Parameters:
connectionNull
- The connectionNull to set.
-
serverSupportsQryclsimp
final boolean serverSupportsQryclsimp()Check whether the server has full support for the QRYCLSIMP parameter in OPNQRY.- Returns:
- true if QRYCLSIMP is fully supported
-
serverSupportsLayerBStreaming
public final boolean serverSupportsLayerBStreaming() -
serverSupportLongRDBNAM
public final boolean serverSupportLongRDBNAM() -
supportsSessionDataCaching
protected final boolean supportsSessionDataCaching()Check whether the server supports session data caching- Specified by:
supportsSessionDataCaching
in classClientConnection
- Returns:
- true session data caching is supported
-
serverSupportsUtf8Ccsid
protected final boolean serverSupportsUtf8Ccsid()Check whether the server supports the UTF-8 Ccsid Manager- Returns:
- true if the server supports the UTF-8 Ccsid Manager
-
serverSupportsUDTs
protected final boolean serverSupportsUDTs()Check whether the server supports UDTs- Returns:
- true if UDTs are supported
-
serverSupportsEXTDTAAbort
protected final boolean serverSupportsEXTDTAAbort() -
serverSupportsLocators
protected final boolean serverSupportsLocators()Checks whether the server supports locators for large objects.- Specified by:
serverSupportsLocators
in classClientConnection
- Returns:
true
if LOB locators are supported.
-
serverSupportsTimestampNanoseconds
protected final boolean serverSupportsTimestampNanoseconds()Return true if the server supports nanoseconds in timestamps- Specified by:
serverSupportsTimestampNanoseconds
in classClientConnection
-
isOpen
public boolean isOpen()Returns if a transaction is in process- Returns:
- open
-
writeXACommit_
Invokes write commit on NetXAConnection- Specified by:
writeXACommit_
in classClientConnection
- Throws:
SqlException
-
readXACommit_
Invokes readCommit on NetXAConnection- Specified by:
readXACommit_
in classClientConnection
- Throws:
SqlException
-
writeXARollback_
Invokes writeRollback on NetXAConnection- Specified by:
writeXARollback_
in classClientConnection
- Throws:
SqlException
-
readXARollback_
Invokes writeRollback on NetXAConnection- Specified by:
readXARollback_
in classClientConnection
- Throws:
SqlException
-
writeXATransactionStart
- Specified by:
writeXATransactionStart
in classClientConnection
- Throws:
SqlException
-
createArrayOf
- Throws:
SQLException
-
createNClob
- Throws:
SQLException
-
createSQLXML
- Throws:
SQLException
-
createStruct
- Throws:
SQLException
-
isValid
Checks if the connection has not been closed and is still valid. The validity is checked by running a simple query against the database. The timeout specified by the caller is implemented as follows: On the server: uses the queryTimeout functionality to make the query time out on the server in case the server has problems or is highly loaded. On the client: uses a timeout on the socket to make sure that the client is not blocked forever in the cases where the server is "hanging" or not sending the reply.- Parameters:
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.- Returns:
- true if the connection is valid, false otherwise
- Throws:
SQLException
- if the parameter value is illegal or if a database error has occurred
-
close
Close the connection and release its resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classClientConnection
- Throws:
SQLException
- if a database-access error occurs.
-
setClientInfo
setClientInfo
will always throw aSQLClientInfoException
since Derby does not support any properties.- Parameters:
name
- a property keyString
value
- a property valueString
- Throws:
SQLClientInfoException
- always.
-
setClientInfo
setClientInfo
will throw aSQLClientInfoException
unless theproperties
parameter is empty, since Derby does not support any properties. All the property keys in theproperties
parameter are added to failedProperties of the exception thrown, with REASON_UNKNOWN_PROPERTY as the value.- Parameters:
properties
- aProperties
object with the properties to set.- Throws:
SQLClientInfoException
- unless the properties parameter is null or empty.
-
getClientInfo
getClientInfo
always returns anull String
since Derby doesn't support ClientInfoProperties.- Parameters:
name
- aString
value- Returns:
- a
null String
value - Throws:
SQLException
- if the connection is closed.
-
getClientInfo
getClientInfo
always returns an emptyProperties
object since Derby doesn't support ClientInfoProperties.- Returns:
- an empty
Properties
object. - Throws:
SQLException
- if the connection is closed.
-
isWrapperFor
Returns false unlessinterfaces
is implemented- Parameters:
interfaces
- a Class defining an interface.- Returns:
- true if this implements the interface or directly or indirectly wraps an object that does.
- Throws:
SQLException
- if an error occurs while determining whether this is a wrapper for an object with the given interface.
-
unwrap
Returnsthis
if this class implements the interface- Parameters:
interfaces
- a Class defining an interface- Returns:
- an object that implements the interface
- Throws:
SQLException
- if no object if found that implements the interface
-