org.apache.xalan.lib.sql

Class DefaultConnectionPool

public class DefaultConnectionPool extends Object implements ConnectionPool

For internal connectiones, i.e. Connection information supplies in the Stylesheet. The Default Connection Pool will be used.
Constructor Summary
DefaultConnectionPool()
Method Summary
voidfreeUnused()
Go through the connection pool and release any connections that are not InUse;
ConnectiongetConnection()
booleanhasActiveConnections()
Is our ConnectionPool have any connections that are still in Use ?
voidinitializePool()
booleanisEnabled()
Return our current Active state
voidreleaseConnection(Connection con)
voidreleaseConnectionOnError(Connection con)
voidsetDriver(String d)
Set the driver call to be used to create connections
voidsetMinConnections(int n)
Override the current number of connections to keep in the pool.
voidsetPassword(String p)
Set the password in the property set.
voidsetPoolEnabled(boolean flag)
The Pool can be Enabled and Disabled.
voidsetProtocol(Properties p)
The Protocol string is used to pass in other connection properties.
voidsetURL(String url)
Set the url used to connect to the database
voidsetUser(String u)
Set the user name in the property set
booleantestConnection()
Try to aquire a new connection, if it succeeds then return true, else return false.

Constructor Detail

DefaultConnectionPool

public DefaultConnectionPool()

Method Detail

freeUnused

public void freeUnused()
Go through the connection pool and release any connections that are not InUse;

getConnection

public Connection getConnection()

Returns: Connection

Throws: SQLException IllegalArgumentException

hasActiveConnections

public boolean hasActiveConnections()
Is our ConnectionPool have any connections that are still in Use ??

initializePool

public void initializePool()

Throws: IllegalArgumentException SQLException

isEnabled

public boolean isEnabled()
Return our current Active state

releaseConnection

public void releaseConnection(Connection con)

Parameters: con

Throws: SQLException

releaseConnectionOnError

public void releaseConnectionOnError(Connection con)

Parameters: con

Throws: SQLException

setDriver

public void setDriver(String d)
Set the driver call to be used to create connections

Parameters: d

setMinConnections

public void setMinConnections(int n)
Override the current number of connections to keep in the pool. This setting will only have effect on a new pool or when a new connection is requested and there is less connections that this setting.

Parameters: n

setPassword

public void setPassword(String p)
Set the password in the property set.

Parameters: p

setPoolEnabled

public void setPoolEnabled(boolean flag)
The Pool can be Enabled and Disabled. Disabling the pool closes all the outstanding Unused connections and any new connections will be closed upon release.

Parameters: flag Control the Connection Pool. If it is enabled then Connections will actuall be held around. If disabled then all unused connections will be instantly closed and as connections are released they are closed and removed from the pool.

setProtocol

public void setProtocol(Properties p)
The Protocol string is used to pass in other connection properties. A properties file is a general purpose container

Parameters: p

setURL

public void setURL(String url)
Set the url used to connect to the database

Parameters: url

setUser

public void setUser(String u)
Set the user name in the property set

Parameters: u

testConnection

public boolean testConnection()
Try to aquire a new connection, if it succeeds then return true, else return false. Note: This method will cause the connection pool to be built.
Copyright B) 2006 Apache XML Project. All Rights Reserved.