Package org.apache.derby.jdbc
Class ClientConnectionPoolDataSource
java.lang.Object
org.apache.derby.jdbc.BasicClientDataSource40
org.apache.derby.jdbc.ClientDataSource
org.apache.derby.jdbc.ClientConnectionPoolDataSource
- All Implemented Interfaces:
Serializable
,Wrapper
,Referenceable
,CommonDataSource
,ConnectionPoolDataSource
,DataSource
,ClientConnectionPoolDataSourceInterface
,ClientDataSourceInterface
- Direct Known Subclasses:
ClientConnectionPoolDataSource40
public class ClientConnectionPoolDataSource
extends ClientDataSource
implements ClientConnectionPoolDataSourceInterface
This datasource is suitable for a client/server use of Derby,
running on full Java SE 6 and higher, corresponding to JDBC 4.0 and higher.
ClientConnectionPoolDataSource is a factory for PooledConnection objects.
An object that implements this interface
will typically be registered with a naming service that is based on the
Java Naming and Directory Interface (JNDI).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
private int
Specifies the maximum number of statements that can be cached per connection by the JDBC driver.private static final MessageUtil
Message utility used to obtain localized messages.private static final long
Fields inherited from class org.apache.derby.jdbc.BasicClientDataSource40
CLEAR_TEXT_PASSWORD_SECURITY, ENCRYPTED_PASSWORD_SECURITY, ENCRYPTED_USER_AND_PASSWORD_SECURITY, propertyDefault_traceLevel, SSL_BASIC, SSL_OFF, SSL_PEER_AUTHENTICATION, STRONG_PASSWORD_SUBSTITUTE_SECURITY, TRACE_ALL, TRACE_CONNECTION_CALLS, TRACE_CONNECTS, TRACE_DIAGNOSTICS, TRACE_DRIVER_CONFIGURATION, TRACE_NONE, TRACE_PARAMETER_META_DATA, TRACE_PROTOCOL_FLOWS, TRACE_RESULT_SET_CALLS, TRACE_RESULT_SET_META_DATA, TRACE_STATEMENT_CALLS, TRACE_XA_CALLS, USER_ONLY_SECURITY
Fields inherited from interface org.apache.derby.jdbc.ClientDataSourceInterface
CLEAR_TEXT_PASSWORD_SECURITY, ENCRYPTED_PASSWORD_SECURITY, ENCRYPTED_USER_AND_PASSWORD_SECURITY, propertyDefault_portNumber, propertyDefault_retrieveMessageText, propertyDefault_securityMechanism, propertyDefault_serverName, propertyDefault_traceFileAppend, propertyDefault_user, STRONG_PASSWORD_SUBSTITUTE_SECURITY, USER_ONLY_SECURITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the maximum number of JDBC prepared statements a connection is allowed to cache.getPooledConnection
(String user, String password) int
Internally used method.private void
readObject
(ObjectInputStream inputStream) Read an object from the ObjectInputStream.void
setMaxStatements
(int maxStatements) Specifies the maximum size of the statement cache.private final void
Make sure the state of the de-serialized object is valid.Methods inherited from class org.apache.derby.jdbc.ClientDataSource
getReference
Methods inherited from class org.apache.derby.jdbc.BasicClientDataSource40
computeDncLogWriterForNewConnection, getClientSSLMode, getConnection, getConnection, getConnectionAttributes, getCreateDatabase, getDatabaseName, getDataSourceName, getDescription, getLoginTimeout, getLogWriter, getParentLogger, getPassword, getPassword, getPooledConnectionMinion, getPooledConnectionMinion, getPortNumber, getProperties, getRetrieveMessageText, getRetrieveMessageText, getSecurityMechanism, getSecurityMechanism, getSecurityMechanism, getServerName, getShutdownDatabase, getSsl, getSSLModeFromString, getTraceDirectory, getTraceDirectory, getTraceFile, getTraceFile, getTraceFileAppend, getTraceFileAppend, getTraceLevel, getTraceLevel, getUser, getUser, getXAConnectionMinion, getXAConnectionMinion, isWrapperFor, setConnectionAttributes, setCreateDatabase, setDatabaseName, setDataSourceName, setDescription, setLoginTimeout, setLogWriter, setPassword, setPortNumber, setRetrieveMessageText, setSecurityMechanism, setServerName, setShutdownDatabase, setSsl, setTraceDirectory, setTraceFile, setTraceFileAppend, setTraceLevel, setUser, tokenizeAttributes, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.derby.jdbc.ClientDataSourceInterface
getConnectionAttributes, getCreateDatabase, getDatabaseName, getDataSourceName, getDescription, getPassword, getPortNumber, getRetrieveMessageText, getSecurityMechanism, getSecurityMechanism, getServerName, getShutdownDatabase, getSsl, getTraceDirectory, getTraceFile, getTraceFileAppend, getTraceLevel, getUser, setConnectionAttributes, setCreateDatabase, setDatabaseName, setDataSourceName, setDescription, setPassword, setPortNumber, setRetrieveMessageText, setSecurityMechanism, setServerName, setShutdownDatabase, setSsl, setTraceDirectory, setTraceFile, setTraceFileAppend, setTraceLevel, setUser
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder, getParentLogger
Methods inherited from interface javax.sql.ConnectionPoolDataSource
createPooledConnectionBuilder, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder, getConnection, getConnection, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
msgUtil
Message utility used to obtain localized messages. -
className__
- See Also:
-
maxStatements
private int maxStatementsSpecifies the maximum number of statements that can be cached per connection by the JDBC driver.A value of
0
disables statement caching, negative values are not allowed. The default is that caching is disabled.
-
-
Constructor Details
-
ClientConnectionPoolDataSource
public ClientConnectionPoolDataSource()
-
-
Method Details
-
getPooledConnection
- Specified by:
getPooledConnection
in interfaceConnectionPoolDataSource
- Throws:
SQLException
-
getPooledConnection
- Specified by:
getPooledConnection
in interfaceConnectionPoolDataSource
- Throws:
SQLException
-
setMaxStatements
public void setMaxStatements(int maxStatements) Specifies the maximum size of the statement cache.- Specified by:
setMaxStatements
in interfaceClientConnectionPoolDataSourceInterface
- Parameters:
maxStatements
- maximum number of cached statements- Throws:
IllegalArgumentException
- ifmaxStatements
is negative
-
getMaxStatements
public int getMaxStatements()Returns the maximum number of JDBC prepared statements a connection is allowed to cache.- Specified by:
getMaxStatements
in interfaceClientConnectionPoolDataSourceInterface
- Returns:
- Maximum number of statements to cache, or
0
if caching is disabled (default).
-
maxStatementsToPool
public int maxStatementsToPool()Internally used method.- Overrides:
maxStatementsToPool
in classBasicClientDataSource40
- Returns:
- Maximum number of statements to cache, or
0
if caching is disabled (default). - See Also:
-
validateState
private final void validateState()Make sure the state of the de-serialized object is valid. -
readObject
Read an object from the ObjectInputStream.This implementation differs from the default one by initiating state validation of the object created.
- Parameters:
inputStream
- data stream to read objects from- Throws:
ClassNotFoundException
- if instantiating a class failsIOException
- if reading from the stream fails
-