public class AS400JDBCManagedConnectionPoolDataSource extends AS400JDBCManagedDataSource implements javax.sql.ConnectionPoolDataSource, javax.naming.Referenceable, java.io.Serializable
AS400JDBCManagedDataSource
to produce PooledConnection objects (AS400JDBCPooledConnection
)
that are managed by the Toolbox's built-in connection pooling manager.
A ConnectionPoolDataSource is a factory for PooledConnection objects. An object that implements the ConnectionPoolDataSource interface will typically be registered with a naming service that is based on the Java Naming and Directory Interface (JNDI).
The operations on a ConnectionPoolDataSource class are completely internal to a driver implementation; the ConnectionPoolDataSource interface is not part of the API typically used by Java application programmers. Driver vendors use it in their implementation of connection pooling. Application programmers specify a DataSource class in their code to get a connection. However, since users/database administrators must register the corresponding ConnectionPoolDataSource with JNDI, the class needs to be public. Users must be able to call the different getters/setters to set up their connection pooling environment when they register the ConnectionPoolDataSource. Drivers then provide DataSource classes that implement javax.sql.DataSource, and the user will use this data source in their code.
Design note: This class extends AS400JDBCManagedDataSource, solely in order to exploit shared implementation. This class should not be used as a "kind of" AS400JDBCManagedDataSource.
Caution: To avoid the pitfalls of "double-managed" pools, do not use this class in conjunction with a
separate connection pool manager, such as that available in WebSphere.
When a separate pool manager is provided,
use AS400JDBCConnectionPoolDataSource
instead.
MAX_STORAGE_LIMIT, SERVER_TRACE_DEBUG_SERVER_JOB, SERVER_TRACE_SAVE_SERVER_JOBLOG, SERVER_TRACE_SAVE_SQL_INFORMATION, SERVER_TRACE_START_DATABASE_MONITOR, SERVER_TRACE_TRACE_SERVER_JOB
Constructor and Description |
---|
AS400JDBCManagedConnectionPoolDataSource()
Constructs a default AS400JDBCManagedConnectionPoolDataSource object.
|
AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName)
Constructs an AS400JDBCManagedConnectionPoolDataSource with the specified serverName.
|
AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName,
java.lang.String user,
char[] password)
Constructs an AS400JDBCManagedConnectionPoolDataSource with the specified signon information.
|
AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName,
java.lang.String user,
java.lang.String password)
Constructs an AS400JDBCManagedConnectionPoolDataSource with the specified signon information.
|
AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName,
java.lang.String user,
java.lang.String password,
java.lang.String keyRingNameX,
java.lang.String keyRingPasswordX)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkPoolHealth(boolean logStatistics)
Deprecated.
Use
checkPoolHealth() instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. |
void |
closePool()
Deprecated.
Use
closePool() instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. |
java.sql.Connection |
getConnection()
Deprecated.
Use
getConnection() instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Deprecated.
Use
getConnection() instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass. |
int |
getInitialPoolSize()
Returns the number of physical connections the connection pool should contain when it is created.
|
int |
getMaxIdleTime()
Returns the amount of time (in seconds) after which an available pooled
physical connection is considered "stale" and should be closed.
|
int |
getMaxLifetime()
Returns the maximum amount of time (in seconds) after which a
physical connection is considered to be expired and should be closed.
|
int |
getMaxPoolSize()
Returns the maximum number of physical connections that the connection pool
contains.
|
int |
getMinPoolSize()
Returns the minimum number of physical connections that the connection pool
contains.
|
javax.sql.PooledConnection |
getPooledConnection()
Returns a pooled connection that is connected to the IBM i system.
|
javax.sql.PooledConnection |
getPooledConnection(java.lang.String user,
char[] password)
Returns a pooled connection that is connected to the IBM i system.
|
javax.sql.PooledConnection |
getPooledConnection(java.lang.String user,
java.lang.String password)
Returns a pooled connection that is connected to the IBM i system.
|
int |
getPropertyCycle()
Returns the interval (in seconds) between runs of the connection pool's
maintenance thread.
|
javax.naming.Reference |
getReference()
Returns a Reference object for the data source object.
|
boolean |
isEnforceMaxPoolSize()
Indicates whether pool size restriction should be strictly enforced.
|
boolean |
isPretestConnections()
Indicates whether connections are pretested before being allocated to a requester.
|
boolean |
isReuseConnections()
Indicates whether connections are re-used after being returned to the connection pool.
|
void |
setEnforceMaxPoolSize(boolean enforce)
Sets whether pool size restriction should be strictly enforced.
|
void |
setInitialPoolSize(int initialPoolSize)
Sets the number of connections that the connection pool contains when it is created.
|
void |
setMaxIdleTime(int maxIdleTime)
Sets the maximum amount of time (in seconds) that a pooled
connection in this pool is allowed to remain idle before it is
automatically closed.
|
void |
setMaxLifetime(int maxLifetime)
Sets the maximum amount of time (in seconds) after which an
in-use physical connection is considered to be expired and should be closed.
|
void |
setMaxPoolSize(int maxPoolSize)
Sets the maximum number of connections that the connection pool
contains.
|
void |
setMinPoolSize(int minPoolSize)
Sets the minimum number of connections that the connection pool
contains.
|
void |
setPretestConnections(boolean pretest)
Sets whether connections are pretested before being allocated to requesters.
|
void |
setPropertyCycle(int propertyCycle)
Sets the interval (in seconds) between runs of the connection pool's
maintenance thread.
|
void |
setReuseConnections(boolean reuse)
Sets whether connections may be re-used after being returned to the connection pool.
|
clone, getAccess, getAffinityFailbackInterval, getBehaviorOverride, getBidiStringType, getBlockCriteria, getBlockSize, getCharacterTruncation, getClientRerouteAlternatePortNumber, getClientRerouteAlternateServerName, getConcurrentAccessResolution, getConnection, getCursorSensitivity, getDatabaseName, getDataSourceName, getDateFormat, getDateSeparator, getDecfloatRoundingMode, getDecimalDataErrors, getDecimalSeparator, getDescribeOption, getDescription, getDriver, getEnableClientAffinitiesList, getEnableSeamlessFailover, getErrors, getIgnoreWarnings, getLibraries, getLobThreshold, getLoginTimeout, getLogWriter, getMaximumBlockedInputRows, getMaximumPrecision, getMaximumScale, getMaxRetriesForClientReroute, getMetadataSource, getMetaDataSource, getMinimumDivideScale, getNaming, getNumericRangeError, getPackage, getPackageCcsid, getPackageCCSID, getPackageCriteria, getPackageError, getPackageLibrary, getPortNumber, getProxyServer, getQaqqinilib, getQaqqiniLibrary, getQueryOptimizeGoal, getQueryReplaceTruncatedParameter, getQueryStorageLimit, getQueryTimeoutMechanism, getReceiveBufferSize, getRemarks, getRetryIntervalForClientReroute, getSecondaryUrl, getSecondaryURL, getSendBufferSize, getServerName, getServerTrace, getServerTraceCategories, getSocketTimeout, getSoLinger, getSort, getSortLanguage, getSortTable, getSortWeight, getSoTimeout, getTimeFormat, getTimeSeparator, getTimestampFormat, getToolboxTrace, getToolboxTraceCategory, getTransactionIsolation, getTranslateHex, getUser, getValidWrappedList, getVariableFieldCompression, getXALooselyCoupledSupport, invalidate, isAutoCommit, isAutocommitException, isBidiImplicitReordering, isBidiNumericOrdering, isBigDecimal, isCursorHold, isDataCompression, isDataTruncation, isExtendedDynamic, isExtendedMetadata, isExtendedMetaData, isFullOpen, isHoldInputLocators, isHoldStatements, isJvm16Synchronize, isKeepAlive, isLazyClose, isPackageAdd, isPackageCache, isPackageClear, isPrefetch, isPrompt, isRollbackCursorHold, isSavePasswordWhenSerialized, isSecure, isSecureCurrentUser, isTcpNoDelay, isThreadUsed, isTrace, isTranslateBinary, isTranslateBoolean, isTrueAutocommit, isTrueAutoCommit, isUseBlockUpdate, isUseDrdaMetadataVersion, setAccess, setAffinityFailbackInterval, setAutoCommit, setAutocommitException, setBehaviorOverride, setBidiImplicitReordering, setBidiNumericOrdering, setBidiStringType, setBigDecimal, setBlockCriteria, setBlockSize, setCharacterTruncation, setClientRerouteAlternatePortNumber, setClientRerouteAlternateServerName, setConcurrentAccessResolution, setCursorHold, setCursorSensitivity, setDatabaseName, setDataCompression, setDataSourceName, setDataTruncation, setDateFormat, setDateSeparator, setDecfloatRoundingMode, setDecimalDataErrors, setDecimalSeparator, setDescribeOption, setDescription, setDriver, setEnableClientAffinitiesList, setEnableSeamlessFailover, setErrors, setExtendedDynamic, setExtendedMetadata, setExtendedMetaData, setFullOpen, setHoldInputLocators, setHoldStatements, setIgnoreWarnings, setJvm16Synchronize, setKeepAlive, setLazyClose, setLibraries, setLobThreshold, setLoginTimeout, setLogWriter, setMaximumBlockedInputRows, setMaximumPrecision, setMaximumScale, setMaxRetriesForClientReroute, setMetadataSource, setMetaDataSource, setMinimumDivideScale, setNaming, setNumericRangeError, setPackage, setPackageAdd, setPackageCache, setPackageCcsid, setPackageCCSID, setPackageClear, setPackageCriteria, setPackageError, setPackageLibrary, setPassword, setPassword, setPortNumber, setPrefetch, setPrompt, setProperties, setProperties, setProxyServer, setQaqqinilib, setQaqqiniLibrary, setQueryOptimizeGoal, setQueryReplaceTruncatedParameter, setQueryStorageLimit, setQueryTimeoutMechanism, setReceiveBufferSize, setRemarks, setRetryIntervalForClientReroute, setRollbackCursorHold, setSavePasswordWhenSerialized, setSecondaryUrl, setSecondaryURL, setSecure, setSecureCurrentUser, setSendBufferSize, setServerName, setServerTrace, setServerTraceCategories, setSocketTimeout, setSoLinger, setSort, setSortLanguage, setSortTable, setSortWeight, setSoTimeout, setTcpNoDelay, setThreadUsed, setTimeFormat, setTimeSeparator, setTimestampFormat, setToolboxTrace, setToolboxTraceCategory, setTrace, setTransactionIsolation, setTranslateBinary, setTranslateBoolean, setTranslateHex, setTrueAutocommit, setTrueAutoCommit, setUseBlockUpdate, setUseDrdaMetadataVersion, setUser, setVariableFieldCompression, setXALooselyCoupledSupport, toString
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public AS400JDBCManagedConnectionPoolDataSource()
public AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName)
serverName
- The IBM i system name.public AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName, java.lang.String user, java.lang.String password)
serverName
- The IBM i system name.user
- The user id.password
- The password.public AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName, java.lang.String user, char[] password)
serverName
- The IBM i system name.user
- The user id.password
- The password.public AS400JDBCManagedConnectionPoolDataSource(java.lang.String serverName, java.lang.String user, java.lang.String password, java.lang.String keyRingNameX, java.lang.String keyRingPasswordX)
serverName
- The IBM i system name.user
- The user id.password
- The password.keyRingNameX
- The key ring class name to be used for SSL communications with the system.keyRingPasswordX
- The password for the key ring class to be used for SSL communications with the system.public boolean checkPoolHealth(boolean logStatistics)
checkPoolHealth()
instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass.checkPoolHealth
in class AS400JDBCManagedDataSource
logStatistics
- If true, additional information is logged.public void closePool()
closePool()
instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass.closePool
in class AS400JDBCManagedDataSource
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection()
instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass.getConnection
in interface javax.sql.DataSource
getConnection
in class AS400JDBCManagedDataSource
java.sql.SQLException
- If a database error occurs.AS400JDBCManagedDataSource.setDataSourceName(java.lang.String)
public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getConnection()
instead. Refer to the class overview for a discussion of the intended role of this class, and the relationship between this class and its superclass.getConnection
in interface javax.sql.DataSource
getConnection
in class AS400JDBCManagedDataSource
user
- The database user.password
- The database password.java.sql.SQLException
- If a database error occurs.AS400JDBCManagedDataSource.setDataSourceName(java.lang.String)
public int getInitialPoolSize()
public int getMaxIdleTime()
public int getMaxLifetime()
public int getMaxPoolSize()
public int getMinPoolSize()
public javax.sql.PooledConnection getPooledConnection() throws java.sql.SQLException
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
java.sql.SQLException
- If a database error occurs.public javax.sql.PooledConnection getPooledConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
user
- The userid for the connection.password
- The password for the connection.java.sql.SQLException
- If a database error occurs.public javax.sql.PooledConnection getPooledConnection(java.lang.String user, char[] password) throws java.sql.SQLException
user
- The userid for the connection.password
- The password for the connection.java.sql.SQLException
- If a database error occurs.public int getPropertyCycle()
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
getReference
in class AS400JDBCManagedDataSource
javax.naming.NamingException
- If a naming error occurs resolving the object.public boolean isEnforceMaxPoolSize()
setMaxPoolSize(int)
public boolean isPretestConnections()
public boolean isReuseConnections()
public void setEnforceMaxPoolSize(boolean enforce)
enforce
- If true, then the pool size restriction should be strictly enforced.
The default value is false.setMaxPoolSize(int)
public void setInitialPoolSize(int initialPoolSize)
initialPoolSize
- The number of pooled connections. Valid values
are 0 or greater. The default value is 5.public void setMaxIdleTime(int maxIdleTime)
maxIdleTime
- The maximum idle time for a pooled connection, in seconds.
Valid values are 0 or greater.
The default value is 1 hour.public void setMaxLifetime(int maxLifetime)
maxLifetime
- The maximum lifetime for an in-use connection, in seconds.
Valid values are 0 or greater.
The default value is 24 hours.public void setMaxPoolSize(int maxPoolSize)
maxPoolSize
- The maximum number of connections in this pool.
Valid values are 0 or greater. The default value is 0 (no maximum).setEnforceMaxPoolSize(boolean)
public void setMinPoolSize(int minPoolSize)
minPoolSize
- The minimum number of available connections in the pool.
Valid values are 0 or greater. The default value is 0.public void setPretestConnections(boolean pretest)
pretest
- If true, then connections are pretested; if false, then connections are not pretested.
The default value is false.public void setPropertyCycle(int propertyCycle)
propertyCycle
- The number of seconds that this pool should wait before enforcing
its properties. Valid values are 0 or greater. The default value is 5 minutes.public void setReuseConnections(boolean reuse)
reuse
- If true, then connections may be reused; if false, then connections are closed after they are returned to the pool. The default value is true.