skip to main content
DataDirect Connection Pooling : DataDirect Connection Pool Interfaces : PooledConnectionDataSource
 

Try DataDirect Cloud Now

PooledConnectionDataSource

The PooledConnectionDataSource interface is used to create a PooledConnectionDataSource object for use with the DataDirect Connection Pool Manager.
PooledConnectionDataSource Methods
Description
void close()
Closes the connection pool. All physical connections in the pool are closed. Any subsequent connection request re-initializes the connection pool.
Connection getConnection()
Obtains a physical connection from the connection pool.
Connection getConnection(String user, String password)
Obtains a physical connection from the connection pool, where user is the user requesting the connection and password is the password for the connection.
String getDataSourceName()
Returns the JNDI name that is used to look up the DataDirect DataSource object referenced by this PooledConnectionDataSource.
String getDescription()
Returns the description of this PooledConnectionDataSource.
int getInitialPoolSize()
Returns the value of the initial pool size, which is the number of physical connections created when the connection pool is initialized.
int getLoginTimeout()
Returns the value of the login timeout, which is the time allowed for the data store login to be validated.
PrintWriter getLogWriter()
Returns the writer to which the Pool Manager sends trace information about its activities.
int getMaxIdleTime()
Returns the value of the maximum idle time, which is the time a physical connection can remain idle in the connection pool before it is removed from the connection pool.
int getMaxPoolSize()
Returns the value of the maximum pool size. See Configuring Pool Size for more information about how the Pool Manager implements the maximum pool size.
int getMaxPoolSizeBehavior()
Returns the value of the maximum pool size behavior. See Configuring Pool Size for more information about how the Pool Manager implements the maximum pool size.
int getMinPoolSize()
Returns the value of the minimum pool size, which is the minimum number of idle connections to be kept in the pool.
int getPropertyCycle()
Returns the value of the property cycle, which specifies how often the pool maintenance thread wakes up and checks the connection pool.
Reference getReference()
Obtains a javax.naming.Reference object for this PooledConnectionDataSource. The Reference object contains all the state information needed to recreate an instance of this data source using the PooledConnectionDataSourceFactory object. This method is typically called by a JNDI service provider when this PooledConnectionDataSource is bound to a JNDI naming service.
public static ConnectionPoolMonitor[ ] getMonitor()
Returns an array of Connection Pool Monitors, one for each connection pool managed by the Pool Manager.
public static ConnectionPoolMonitor getMonitor(String name)
Returns the name of the Connection Pool Monitor for the connection pool specified by name. If a pool with the specified name cannot be found, this method returns null. The connection pool name has the form:
jndi_name-user_id
where jndi_name is the name used for the JNDI lookup of the driver DataSource object from which the pooled connection was obtained and user_id is the user ID used to establish the connections contained in the pool.The following example shows how to return the Connection Pool Monitor for the connection pool that is bound to the JNDI lookup name jdbc/PoolCloudSparky and connections established by user test04.
DataSource ds = (DataSource)
ctx.lookup("jdbc/PoolCloudSparky");
Connection con = ds.getConnection
("test04", "test04");
ConnectionPoolMonitor monitor =
PooledConnectionDataSource.getMonitor
("jdbc/PoolCloudSparky-test04");
boolean isTracing()
Determines whether tracing is enabled. If enabled, tracing information is sent to the PrintWriter that is passed to the setLogWriter() method or the standard output System.out if the setLogWriter() method is not called.
void setDataSourceName(String dataSourceName)
Sets the JNDI name, which is used to look up the driver DataSource object referenced by this PooledConnectionDataSource. The driver DataSource object bound to this PooleConnectionDataSource, specified by dataSourceName, is not persisted. Any changes made to the PooledConnectionDataSource bound to the specified driver DataSource object affect this PooledConnectionDataSource.
void setDataSourceName(String dataSourceName, ConnectionPoolDataSource dataSource)
Sets the JNDI name associated with this PooledConnectionDataSource, specified by dataSourceName, and the driver DataSource object, specified by dataSource, referenced by this PooledConnectionDataSource.
The driver DataSource object, specified by dataSource, is persisted with this PooledConnectionDataSource. Changes made to the specified driver DataSource object after this PooledConnectionDataSource is persisted do not affect this PooledConnectionDataSource.
void setDataSourceName(String dataSourceName, Context ctx)
Sets the JNDI name, specified by dataSourceName, and context, specified by ctx, to be used to look up the driver DataSource referenced by this PooledConnectionDataSource.
The JNDI name, specified by dataSourceName, and context, specified by ctx, are used to look up a driver DataSource object.
The driver DataSource object is persisted with this PooledConnectionDataSource. Changes made to the driver DataSource after this PooledConnectionDataSource is persisted do not affect this PooledConnectionDataSource.
void setDescription(String description)
Sets the description of the PooledConnectionDataSource, where description is the description.
void setInitialPoolSize(int initialPoolSize)
Sets the value of the initial pool size, which is the number of connections created when the connection pool is initialized.
void setLoginTimeout(int i)
Sets the value of the login timeout, where i is the login timeout, which is the time allowed for the data store login to be validated.
void setLogWriter(PrintWriter printWriter)
Sets the writer, where printWriter is the writer to which the stream will be printed.
void setMaxIdleTime(int maxIdleTime)
Sets the value of the maximum idle time, which is the time a connection can remain idle in the connection pool before it is closed and removed from the pool.
void setMaxPoolSize(int maxPoolSize)
Sets the value of the maximum pool size, which is the maximum number of connections for each user allowed in the pool. See Configuring Pool Size for more information about how the Pool Manager implements the maximum pool size.
void setMaxPoolSizeBehavior(String value)
Sets the value of the maximum pool size behavior, which is either softCap or hardCap.
If setMaxPoolSizeBehavior(softCap), the number of active connections may exceed the maximum pool size, but the number of idle connections in the connection pool for each user cannot exceed this limit. If a user requests a connection and an idle connection is unavailable, the Pool Manager creates a new connection for that user. When the connection is no longer needed, it is returned to the pool. If the number of idle connections exceeds the maximum pool size, the Pool Manager closes idle connections to enforce the maximum pool size limit. This is the default behavior.
If setMaxPoolSizeBehavior(hardCap), the total number of active and idle connections cannot exceed the maximum pool size. Instead of creating a new connection for a connection request if an idle connection is unavailable, the Pool Manager queues the connection request until a connection is available or the request times out. This behavior is useful if your data store server has memory limitations or is licensed for only a specific number of connections.The timeout is set using the LoginTimeout connection property. If the connection request times out, the driver throws an exception.
See Configuring Pool Sizefor more information about how the Pool Manager implements the maximum pool size.
void setMinPoolSize(int minPoolSize)
Sets the value of the minimum pool size, which is the minimum number of idle connections to be kept in the connection pool.
void setPropertyCycle(int propertyCycle)
Sets the value of the property cycle, which specifies how often the pool maintenance thread wakes up and checks the connection pool.
void setTracing(boolean value)
Enables or disables tracing. If set to true, tracing is enabled; if false, it is disabled. If enabled, tracing information is sent to the PrintWriter that is passed to the setLogWriter() method or the standard output System.out if the setLogWriter() method is not called.