|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.firebirdsql.pool.AbstractConnectionPool
org.firebirdsql.pool.FBConnectionPoolDataSource
Connection pool for Firebird JDBC driver.
Field Summary | |
static java.lang.String |
BLOB_BUFFER_PROPERTY
|
static org.firebirdsql.pool.FBConnectionPoolDataSource.UserPasswordPair |
EMPTY_USER_PASSWORD
|
static java.lang.String |
ENCODING_PROPERTY
|
static java.lang.String |
PASSWORD_PROPERTY
|
static java.lang.String |
SOCKET_BUFFER_PROPERTY
|
static java.lang.String |
SQL_ROLE_PROPERTY
|
static java.lang.String |
TPB_MAPPING_PROPERTY
|
static java.lang.String |
USER_NAME_PROPERTY
|
Constructor Summary | |
FBConnectionPoolDataSource()
Create instance of this class. |
Method Summary | |
PooledObject |
allocateConnection(java.lang.Object key)
Allocate new physical connection for the specified user name and password. |
void |
connectionClosed(javax.sql.ConnectionEvent connectionEvent)
Notify about connection being closed. |
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
Notify about serious error when using the connection. |
int |
getBlobBufferSize()
|
int |
getBlockingTimeout()
Get pool blocking timeout. |
java.lang.String |
getCharSet()
|
ConnectionPoolConfiguration |
getConfiguration()
Get configuration of this data source. |
protected PooledConnectionManager |
getConnectionManager()
Get instance of PooledConnectionManager responsible for
instantiating pooled connections. |
java.lang.String |
getDatabase()
Get database to which we will connect. |
javax.naming.Reference |
getDefaultReference()
Get default JNDI reference for this datasource. |
java.lang.String |
getEncoding()
|
int |
getFreeSize()
Get number of free connections in this pool. |
GDSType |
getGDSType()
Get type of JDBC driver that is used. |
int |
getIdleTimeout()
Get idle timeout. |
protected org.firebirdsql.logging.Logger |
getLogger()
Get logger for this instance. |
int |
getLoginTimeout()
Get login timeout. |
java.io.PrintWriter |
getLogWriter()
|
int |
getMaxConnections()
Get maximum number of physical connections in the pool. |
int |
getMinConnections()
Get minimum number of open physical connections that are kept in pool. |
java.lang.String |
getNonStandardProperty(java.lang.String key)
|
java.lang.Object |
getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable environment)
Get object instance for the specified name in the specified context. |
java.lang.String |
getPassword()
|
int |
getPingInterval()
Get time interval, after which connection is marked to be pinged on first request to it. |
java.lang.String |
getPingStatement()
Get SQL statement that will be used to "ping" the connection. |
javax.sql.PooledConnection |
getPooledConnection()
Get pooled connection. |
protected PooledObject |
getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue)
Get pooled connection from the pooled queue. |
javax.sql.PooledConnection |
getPooledConnection(java.lang.String user,
java.lang.String password)
Get pooled connection for the specified user name and password. |
protected java.lang.String |
getPoolName()
Get name of the connection queue. |
java.util.Properties |
getProperties()
Get JDBC connection properties. |
javax.naming.Reference |
getReference()
Get JDNI reference. |
int |
getRetryInterval()
Get retry interval. |
int |
getSocketBufferSize()
|
java.lang.String |
getSqlRole()
|
int |
getTotalSize()
Get total size of physical connections opened to the database. |
java.lang.String |
getTpbMapping()
|
java.lang.String |
getType()
Get type of JDBC driver that will be used. |
java.lang.String |
getUserName()
|
int |
getWorkingSize()
Get number of connections that are in use. |
boolean |
isPingable()
Check if this configuation defines a pingable connection JDBC pool. |
void |
setBlobBufferSize(int blobBufferSize)
|
void |
setBlockingTimeout(int blockingTimeout)
Set blocking timeout. |
void |
setCharSet(java.lang.String charSet)
|
void |
setDatabase(java.lang.String database)
Set database name. |
void |
setEncoding(java.lang.String encoding)
|
void |
setGDSType(GDSType gdsType)
Set type of the JDBC driver to use. |
void |
setIdleTimeout(int idleTimeout)
Set idle timeout. |
void |
setIntProperty(java.lang.String name,
int value)
Set specified property as integer value. |
void |
setLoginTimeout(int seconds)
Set login timeout for new connection. |
void |
setLogWriter(java.io.PrintWriter out)
|
void |
setMaxConnections(int maxConnections)
Set maximum number of open physical connections in the pool. |
void |
setMinConnections(int minConnections)
Set minimum number of open physical connections in the pool. |
void |
setNonStandardProperty(java.lang.String key,
java.lang.String value)
|
void |
setPassword(java.lang.String password)
|
void |
setPingInterval(int pingInterval)
Set ping interval for the connections. |
void |
setProperties(java.util.Properties properties)
Set JDBC properties that will be passed when opening a connection. |
void |
setReference(javax.naming.Reference reference)
Set JNDI reference for this data source. |
void |
setRetryInterval(int retryInterval)
Set retry interval. |
void |
setSocketBufferSize(int socketBufferSize)
|
void |
setSqlRole(java.lang.String sqlRole)
|
void |
setTpbMapping(java.lang.String tpbMapping)
|
void |
setType(java.lang.String type)
Set type of JDBC driver to use. |
void |
setUserName(java.lang.String userName)
|
Methods inherited from class org.firebirdsql.pool.AbstractConnectionPool |
finalize, getQueue, pooledObjectReleased, shutdown |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String USER_NAME_PROPERTY
public static final java.lang.String PASSWORD_PROPERTY
public static final java.lang.String TPB_MAPPING_PROPERTY
public static final java.lang.String BLOB_BUFFER_PROPERTY
public static final java.lang.String ENCODING_PROPERTY
public static final java.lang.String SOCKET_BUFFER_PROPERTY
public static final java.lang.String SQL_ROLE_PROPERTY
public static final org.firebirdsql.pool.FBConnectionPoolDataSource.UserPasswordPair EMPTY_USER_PASSWORD
Constructor Detail |
public FBConnectionPoolDataSource()
Method Detail |
protected org.firebirdsql.logging.Logger getLogger()
AbstractConnectionPool
getLogger
in class AbstractConnectionPool
Logger
.public ConnectionPoolConfiguration getConfiguration()
AbstractConnectionPool
getConfiguration
in class AbstractConnectionPool
ConnectionPoolConfiguration
describing
this data source.protected PooledConnectionManager getConnectionManager()
AbstractConnectionPool
PooledConnectionManager
responsible for
instantiating pooled connections.
getConnectionManager
in class AbstractConnectionPool
PooledConnectionManager
public PooledObject allocateConnection(java.lang.Object key) throws java.sql.SQLException
allocateConnection
in interface PooledConnectionManager
key
- key identifying pooled object.
PooledObject
.
java.sql.SQLException
- if connection cannot be allocated.protected java.lang.String getPoolName()
getPoolName
in class AbstractConnectionPool
AbstractConnectionPool.getPoolName()
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.ConnectionPoolDataSource
public void setLogWriter(java.io.PrintWriter out)
setLogWriter
in interface javax.sql.ConnectionPoolDataSource
public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.ConnectionPoolDataSource
setLoginTimeout(int)
method or 0.public void setLoginTimeout(int seconds)
setLoginTimeout
in interface javax.sql.ConnectionPoolDataSource
seconds
- how long pool should wait until new connection is
granted.protected PooledObject getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue) throws java.sql.SQLException
getPooledConnection
in class AbstractConnectionPool
queue
- instance of PooledConnectionQueue
where connection
will be obtained.
PooledObject
.
java.sql.SQLException
- if pooled connection cannot be obtained.public javax.sql.PooledConnection getPooledConnection() throws java.sql.SQLException
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
PooledConnection
.
java.sql.SQLException
- if pooled connection cannot be obtained.public javax.sql.PooledConnection getPooledConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
user
- user name.password
- password corresponding to specified user name.
PooledConnection
for the specified
credentials.
java.sql.SQLException
- always, this method is not yet implemented.public void connectionClosed(javax.sql.ConnectionEvent connectionEvent)
connectionClosed
in interface javax.sql.ConnectionEventListener
connectionEvent
- instance of ConnectionEvent
.public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
connectionErrorOccurred
in interface javax.sql.ConnectionEventListener
event
- instance of ConnectionEvent
containing
information about an error.public int getFreeSize() throws java.sql.SQLException
AbstractConnectionPool
getMaxSize() != 0 && getMaxSize() == getWorkingSize()
,
meaning that we have allocated maximum number of connections and all
of them are in use.
getFreeSize
in class AbstractConnectionPool
java.sql.SQLException
public int getTotalSize() throws java.sql.SQLException
AbstractConnectionPool
getTotalSize
in class AbstractConnectionPool
java.sql.SQLException
public int getWorkingSize() throws java.sql.SQLException
AbstractConnectionPool
getWorkingSize
in class AbstractConnectionPool
java.sql.SQLException
public java.lang.String getDatabase()
public int getMinConnections()
getMinConnections
in interface ConnectionPoolConfiguration
ConnectionPoolConfiguration.getMinConnections()
public int getMaxConnections()
getMaxConnections
in interface ConnectionPoolConfiguration
ConnectionPoolConfiguration.getMaxConnections()
public java.util.Properties getProperties()
public boolean isPingable()
isPingable
in interface ConnectionPoolConfiguration
true
if this pool supports pingable connections.ConnectionPoolConfiguration.isPingable()
public java.lang.String getPingStatement()
getPingStatement
in interface ConnectionPoolConfiguration
ConnectionPoolConfiguration.getPingStatement()
public int getPingInterval()
getPingInterval
in interface ConnectionPoolConfiguration
ConnectionPoolConfiguration.getPingInterval()
public void setDatabase(java.lang.String database)
database
- connection URL without "jdbc:firebirdsql:"
prefix ("//localhost:3050/c:/database/employee.gdb"
) for
example).public void setMaxConnections(int maxConnections)
maxConnections
- maximum allowed number of open connections in the
pool.getMaxConnections()
public void setMinConnections(int minConnections)
minConnections
- minimum number of open connections in the pool.getMinConnections()
public void setPingInterval(int pingInterval)
pingInterval
- number of milliseconds after which connection is
marked to "ping" before getting it from the pool or 0
to
remove "pingable" property of this pool.getPingInterval()
public void setProperties(java.util.Properties properties)
properties
- instance of Properties
containing properties
of a connection to open.getProperties()
public void setIntProperty(java.lang.String name, int value)
name
- name of the property.value
- value of the property.public int getBlockingTimeout()
getBlockingTimeout
in interface ConnectionPoolConfiguration
Integer.MAX_VALUE
indicates blocking forever.ConnectionPoolConfiguration.getBlockingTimeout()
public void setBlockingTimeout(int blockingTimeout)
blockingTimeout
- blocking timeout to set.ConnectionPoolConfiguration.getBlockingTimeout()
public int getRetryInterval()
getRetryInterval
in interface ConnectionPoolConfiguration
ConnectionPoolConfiguration.getRetryInterval()
public void setRetryInterval(int retryInterval)
retryInterval
- retry interval in millisecondsConnectionPoolConfiguration.getBlockingTimeout()
public int getIdleTimeout()
getIdleTimeout
in interface ConnectionPoolConfiguration
public void setIdleTimeout(int idleTimeout)
idleTimeout
- idle timeout in milliseconds.public java.lang.String getType()
setType(String)
if
you used synonym (either "TYPE4"
or "TYPE2"
).
"PURE_JAVA"
for pure Java type 4 JDBC driver.
"NATIVE"
for type 2 JDBC driver that will use Firebird
client library.
"EMBEDDED"
for type 2 JDBC driver that will use
embedded engine.
public void setType(java.lang.String type) throws java.sql.SQLException
type
- type of driver to use. Possible values are (case insensitive):
"PURE_JAVA"
or "TYPE4"
for pure Java type 4
JDBC driver;
"NATIVE"
or "TYPE2"
for type 2 JDBC driver
that will use Firebird client library.
"EMBEDDED"
for type 2 JDBC driver that will use embedded
version of the server.
java.sql.SQLException
- if specified type is not known.public GDSType getGDSType()
public void setGDSType(GDSType gdsType)
gdsType
- type of the JDBC driver.public java.lang.String getNonStandardProperty(java.lang.String key)
public void setNonStandardProperty(java.lang.String key, java.lang.String value)
public int getBlobBufferSize()
public void setBlobBufferSize(int blobBufferSize)
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
public java.lang.String getCharSet()
public void setCharSet(java.lang.String charSet) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getPassword()
public void setPassword(java.lang.String password)
public int getSocketBufferSize()
public void setSocketBufferSize(int socketBufferSize)
public java.lang.String getSqlRole()
public void setSqlRole(java.lang.String sqlRole)
public java.lang.String getTpbMapping()
public void setTpbMapping(java.lang.String tpbMapping)
public java.lang.String getUserName()
public void setUserName(java.lang.String userName)
public java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment) throws java.lang.Exception
obj
represents
Reference
, whose factory class is equal to this class.
getObjectInstance
in interface javax.naming.spi.ObjectFactory
java.lang.Exception
public javax.naming.Reference getReference()
getReference
in interface javax.naming.Referenceable
Reference
.public void setReference(javax.naming.Reference reference)
setReference
in interface javax.resource.Referenceable
reference
- JNDI reference.public javax.naming.Reference getDefaultReference()
Reference
containing all information
that allows to reconstruct the datasource.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |