|
||||||||||
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.BasicAbstractConnectionPool
org.firebirdsql.pool.FBConnectionPoolDataSource
Connection pool for Firebird JDBC driver. Following properties are supported:
blobBufferSize
size of the buffer used to transfer BLOB data.
blockingTimeout
time in milliseconds during which #getConnection()
method will
block if no free connection is in pool.
charSet
similar to encoding
, but takes Java character set name
instead of Firebird's encoding.
database
path to a database including the server name; for example
localhost/3050:c:/path/to/database.gdb
.
encoding
character encoding for the JDBC connection.
freeSize
read-only: gives amount of free connections in the pool, when 0, blocking
will occur if workingSize
is equal to maxPoolSize
.
isolation
default transaction isolation level for connections as string; possible
values are:
loginTimeout
property from DataSource
, in this context is a synonym
for blockingTimeout
(however value is specified in seconds).
maxIdleTime
time in milliseconds after which idle physical connection in the
pool is closed.
maxStatements
maximum number of pooled prepared statements, if 0, pooling is switched
off.
maxPoolSize
maximum number of physical connections that can be opened by this data
source.
minPoolSize
minimum number of connections that will remain open by this data source.
nonStandardProperty
a non-standard connection parameter in form name[=value]
.
password
password that is used to connect to database.
pingInterval
time interval during which connection will be proved for aliveness.
pooling
allows switching pooling off.
statementPooling
alternative way to switch statement pooling off.
socketBufferSize
size of the socket buffer in bytes. In some cases values used by JVM by
default are not optimal. This results in performance degradation
(especially when you transfer big BLOBs). Usually 8192 bytes provides
good results.
sqlRole
SQL role name.
tpbMapping
mapping of the TPB parameters to JDBC transaction isolation levels.
transactionIsolationLevel
default transaction isolation level, number from Connection
interface.
totalSize
total number of allocated connections.
type
type of connection that will be created. There are four possible types:
pure Java (or type 4), type 2 that will use Firebird client library to
connect to the database, local-mode type 2 driver, and embedded that
will use embedded engine (access to local databases). Possible values
are (case insensitive):
"PURE_JAVA"
or "TYPE4"
for pure Java (type 4) JDBC connections;
"NATIVE"
or "TYPE2"
to use Firebird client library;
"LOCAL"
to use Firebird client library in local-mode (IPC link to server);
"EMBEDDED"
to use embedded engine.
userName
name of the user that will be used to access the database.
workingSize
number of connections that are in use (e.g. were obtained using
#getConnection()
method, but not yet closed).
Nested Class Summary |
Nested classes inherited from class org.firebirdsql.pool.AbstractConnectionPool |
AbstractConnectionPool.UserPasswordPair |
Field Summary | |
static java.lang.String |
BLOB_BUFFER_PROPERTY
|
static AbstractConnectionPool.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. |
protected BasicAbstractConnectionPool |
createObjectInstance()
|
int |
getBlobBufferSize()
|
java.lang.String |
getCharSet()
|
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. |
protected org.firebirdsql.logging.Logger |
getLogger()
Get logger for this instance. |
int |
getLoginTimeout()
Get login timeout. |
java.io.PrintWriter |
getLogWriter()
|
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()
|
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. |
java.lang.String |
getRoleName()
|
int |
getSocketBufferSize()
|
java.lang.String |
getSqlRole()
Deprecated. please use getRoleName() instead. |
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. |
javax.sql.XAConnection |
getXAConnection()
Get XA connection. |
javax.sql.XAConnection |
getXAConnection(java.lang.String user,
java.lang.String password)
Get XA connection for the specified user name and password. |
boolean |
isPingable()
Check if this configuation defines a pingable connection JDBC pool. |
void |
physicalConnectionClosed(javax.sql.ConnectionEvent connectionEvent)
Notify about physical connection being closed. |
void |
physicalConnectionDeallocated(javax.sql.ConnectionEvent connectionEvent)
Notify about the deallocation of the physical connection. |
void |
setBlobBufferSize(int blobBufferSize)
|
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 |
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 |
setNonStandardProperty(java.lang.String propertyMapping)
Method that allows setting non-standard property in the form "key=value" form. |
void |
setNonStandardProperty(java.lang.String key,
java.lang.String value)
|
void |
setPassword(java.lang.String password)
|
void |
setProperties(java.util.Properties properties)
Set JDBC properties that will be passed when opening a connection. |
void |
setRoleName(java.lang.String roleName)
|
void |
setSocketBufferSize(int socketBufferSize)
|
void |
setSqlRole(java.lang.String sqlRole)
Deprecated. please use setRoleName(String) instead. |
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, physicalConnectionDeallocated, pooledObjectReleased, shutdown |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.firebirdsql.pool.FirebirdPool |
getBlockingTimeout, getIsolation, getMaxIdleTime, getMaxPoolSize, getMaxStatements, getMinPoolSize, getPingInterval, getTransactionIsolationLevel, isPooling, isStatementPooling, setBlockingTimeout, setIsolation, setMaxIdleTime, setMaxPoolSize, setMaxStatements, setMinPoolSize, setPingInterval, setPooling, setStatementPooling, setTransactionIsolationLevel, shutdown |
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 AbstractConnectionPool.UserPasswordPair EMPTY_USER_PASSWORD
Constructor Detail |
public FBConnectionPoolDataSource()
Method Detail |
protected org.firebirdsql.logging.Logger getLogger()
AbstractConnectionPool
getLogger
in class AbstractConnectionPool
Logger
.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
getLogWriter
in class BasicAbstractConnectionPool
public void setLogWriter(java.io.PrintWriter out)
setLogWriter
in interface javax.sql.ConnectionPoolDataSource
setLogWriter
in class BasicAbstractConnectionPool
public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.ConnectionPoolDataSource
getLoginTimeout
in class BasicAbstractConnectionPool
setLoginTimeout(int)
method or 0.public void setLoginTimeout(int seconds)
setLoginTimeout
in interface javax.sql.ConnectionPoolDataSource
setLoginTimeout
in class BasicAbstractConnectionPool
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
getPooledConnection
in class BasicAbstractConnectionPool
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
getPooledConnection
in class BasicAbstractConnectionPool
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 javax.sql.XAConnection getXAConnection() throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
XAConnection
.
java.sql.SQLException
- if pooled connection cannot be obtained.public javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
user
- user name.password
- password corresponding to specified user name.
XAConnection
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 physicalConnectionClosed(javax.sql.ConnectionEvent connectionEvent)
physicalConnectionClosed
in interface PooledConnectionEventListener
connectionEvent
- instance of ConnectionEvent
.public void physicalConnectionDeallocated(javax.sql.ConnectionEvent connectionEvent)
physicalConnectionDeallocated
in interface PooledConnectionEventListener
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 interface FirebirdPool
getFreeSize
in class AbstractConnectionPool
java.sql.SQLException
public int getTotalSize() throws java.sql.SQLException
AbstractConnectionPool
getTotalSize
in interface FirebirdPool
getTotalSize
in class AbstractConnectionPool
java.sql.SQLException
public int getWorkingSize() throws java.sql.SQLException
AbstractConnectionPool
getWorkingSize
in interface FirebirdPool
getWorkingSize
in class AbstractConnectionPool
java.sql.SQLException
public java.lang.String getDatabase()
getDatabase
in interface FirebirdPool
public java.util.Properties getProperties()
public boolean isPingable()
isPingable
in interface ConnectionPoolConfiguration
isPingable
in class BasicAbstractConnectionPool
ConnectionPoolConfiguration.isPingable()
public java.lang.String getPingStatement()
getPingStatement
in interface ConnectionPoolConfiguration
getPingStatement
in class BasicAbstractConnectionPool
ConnectionPoolConfiguration.getPingStatement()
public void setDatabase(java.lang.String database)
setDatabase
in interface FirebirdPool
database
- connection URL without "jdbc:firebirdsql:"
prefix ("//localhost:3050/c:/database/employee.gdb"
) for
example).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 java.lang.String getType()
setType(String)
if
you used synonym (either "TYPE4"
or "TYPE2"
).
getType
in interface FirebirdPool
"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
setType
in interface FirebirdPool
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)
getNonStandardProperty
in interface FirebirdPool
public void setNonStandardProperty(java.lang.String key, java.lang.String value)
setNonStandardProperty
in interface FirebirdPool
public void setNonStandardProperty(java.lang.String propertyMapping)
setNonStandardProperty
in interface FirebirdPool
propertyMapping
- mapping between property name (key) and its value.
Name and value are separated with "=", ":" or whitespace character.
Whitespace characters on the beginning of the string and between key and
value are ignored. No escaping is possible: "\n" is backslash-en, not
a new line mark.public int getBlobBufferSize()
getBlobBufferSize
in interface FirebirdPool
public void setBlobBufferSize(int blobBufferSize)
setBlobBufferSize
in interface FirebirdPool
public java.lang.String getEncoding()
getEncoding
in interface FirebirdPool
public void setEncoding(java.lang.String encoding)
setEncoding
in interface FirebirdPool
public java.lang.String getCharSet()
getCharSet
in interface FirebirdPool
public void setCharSet(java.lang.String charSet) throws java.sql.SQLException
setCharSet
in interface FirebirdPool
java.sql.SQLException
public java.lang.String getPassword()
getPassword
in interface FirebirdPool
public void setPassword(java.lang.String password)
setPassword
in interface FirebirdPool
public int getSocketBufferSize()
getSocketBufferSize
in interface FirebirdPool
public void setSocketBufferSize(int socketBufferSize)
setSocketBufferSize
in interface FirebirdPool
public java.lang.String getRoleName()
getRoleName
in interface FirebirdPool
public void setRoleName(java.lang.String roleName)
setRoleName
in interface FirebirdPool
public java.lang.String getSqlRole()
getRoleName()
instead.
public void setSqlRole(java.lang.String sqlRole)
setRoleName(String)
instead.
public java.lang.String getTpbMapping()
getTpbMapping
in interface FirebirdPool
public void setTpbMapping(java.lang.String tpbMapping)
setTpbMapping
in interface FirebirdPool
public java.lang.String getUserName()
getUserName
in interface FirebirdPool
public void setUserName(java.lang.String userName)
setUserName
in interface FirebirdPool
public javax.naming.Reference getDefaultReference()
BasicAbstractConnectionPool
getDefaultReference
in class BasicAbstractConnectionPool
Reference
containing all information
that allows to reconstruct the datasource.protected BasicAbstractConnectionPool createObjectInstance()
createObjectInstance
in class BasicAbstractConnectionPool
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
BasicAbstractConnectionPool
obj
represents
Reference
, whose factory class is equal to this class.
getObjectInstance
in interface javax.naming.spi.ObjectFactory
getObjectInstance
in class BasicAbstractConnectionPool
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |