Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.firebirdsql.pool.AbstractConnectionPool
org.firebirdsql.pool.BasicAbstractConnectionPool
org.firebirdsql.pool.AbstractFBConnectionPoolDataSource
public abstract class AbstractFBConnectionPoolDataSource
extends BasicAbstractConnectionPool
implements PooledConnectionManager, ConnectionPoolDataSource, XADataSource, PooledConnectionEventListener, FirebirdPool
blobBufferSize
size of the buffer used to transfer BLOB data.
blockingTimeout
time in milliseconds during which getPooledConnection()
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 javax.sql.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 java.sql.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
getPooledConnection()
method, but not yet closed).
Nested Class Summary |
Nested classes/interfaces inherited from class org.firebirdsql.pool.AbstractConnectionPool | |
AbstractConnectionPool.UserPasswordPair |
Field Summary | |
static AbstractConnectionPool.UserPasswordPair | |
protected static String | |
protected static String |
Constructor Summary | |
|
Method Summary | |
PooledObject |
|
void |
|
void |
|
protected BasicAbstractConnectionPool | |
int | |
int | |
String | |
protected PooledConnectionManager | |
FBConnectionProperties |
|
String | |
DatabaseParameterBuffer | |
String | |
Reference | |
int | |
String | |
int | |
org.firebirdsql.gds.impl.GDSType |
|
PrintWriter | |
protected org.firebirdsql.logging.Logger | |
int |
|
String |
|
String | |
String |
|
protected String |
|
PooledConnection |
|
PooledConnection |
|
protected PooledObject |
|
String | |
int | |
String | |
String |
|
int | |
String | |
TransactionParameterBuffer |
|
String |
|
String | |
String | |
int | |
XAConnection |
|
XAConnection |
|
boolean | |
boolean |
|
boolean | |
boolean | |
boolean | |
void |
|
void |
|
protected Object |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class org.firebirdsql.pool.AbstractConnectionPool | |
finalize , getConfiguration , getConnectionManager , getFreeSize , getLogger , getPoolName , getPooledConnection , getQueue , getTotalSize , getWorkingSize , physicalConnectionDeallocated , pooledObjectReleased , restart , shutdown |
protected static final String REF_NON_STANDARD_PROPERTY
protected static final String REF_PROPERTIES
public AbstractFBConnectionPoolDataSource()
Create instance of this class.
public PooledObject allocateConnection(Object key) throws SQLException
Allocate new physical connection for the specified user name and password.
- Specified by:
- allocateConnection in interface PooledConnectionManager
- Parameters:
key
- key identifying pooled object.
- Returns:
- instance of
PooledObject
.
public void connectionClosed(ConnectionEvent connectionEvent)
Notify about connection being closed.
- Parameters:
connectionEvent
- instance ofConnectionEvent
.
public void connectionErrorOccurred(ConnectionEvent event)
Notify about serious error when using the connection. Currently these events are ignored.
- Parameters:
event
- instance ofConnectionEvent
containing information about an error.
protected BasicAbstractConnectionPool createObjectInstance()
- Overrides:
- createObjectInstance in interface BasicAbstractConnectionPool
public int getBlobBufferSize()
- Specified by:
- getBlobBufferSize in interface FirebirdConnectionProperties
public int getBuffersNumber()
- Specified by:
- getBuffersNumber in interface FirebirdConnectionProperties
public String getCharSet()
- Specified by:
- getCharSet in interface FirebirdConnectionProperties
protected PooledConnectionManager getConnectionManager()
- Overrides:
- getConnectionManager in interface AbstractConnectionPool
public FBConnectionProperties getConnectionProperties()
Get connection properties. This method returns a live object where connection properties can be set. Usually application does not need to call this method, since this class implements appropriate interface and all properties can set directly. However, this is needed for custom serialization.
- Returns:
- "live" instance of
FBConnectionProperties
.
public String getDatabase()
- Specified by:
- getDatabase in interface FirebirdConnectionProperties
public DatabaseParameterBuffer getDatabaseParameterBuffer() throws SQLException
- Specified by:
- getDatabaseParameterBuffer in interface FirebirdConnectionProperties
public String getDefaultIsolation()
- Specified by:
- getDefaultIsolation in interface FirebirdConnectionProperties
public Reference getDefaultReference()
- Overrides:
- getDefaultReference in interface BasicAbstractConnectionPool
public int getDefaultTransactionIsolation()
- Specified by:
- getDefaultTransactionIsolation in interface FirebirdConnectionProperties
public String getEncoding()
- Specified by:
- getEncoding in interface FirebirdConnectionProperties
public int getFreeSize() throws SQLException
- Specified by:
- getFreeSize in interface FirebirdPool
- Overrides:
- getFreeSize in interface AbstractConnectionPool
public org.firebirdsql.gds.impl.GDSType getGDSType()
Get type of JDBC driver that is used.
- Returns:
- type of JDBC driver that is used.
public PrintWriter getLogWriter()
- Overrides:
- getLogWriter in interface BasicAbstractConnectionPool
protected org.firebirdsql.logging.Logger getLogger()
- Overrides:
- getLogger in interface AbstractConnectionPool
public int getLoginTimeout()
Get login timeout.
- Overrides:
- getLoginTimeout in interface BasicAbstractConnectionPool
- Returns:
- value set in
setLoginTimeout(int)
method or 0.
public String getNonStandardProperty(String key)
- Specified by:
- getNonStandardProperty in interface FirebirdConnectionProperties
public String getPassword()
- Specified by:
- getPassword in interface FirebirdConnectionProperties
public String getPingStatement()
Get SQL statement that will be used to "ping" the connection.
- Specified by:
- getPingStatement in interface ConnectionPoolConfiguration
- Overrides:
- getPingStatement in interface BasicAbstractConnectionPool
protected String getPoolName()
Get name of the connection queue.
- Overrides:
- getPoolName in interface AbstractConnectionPool
- See Also:
AbstractConnectionPool.getPoolName()
public PooledConnection getPooledConnection() throws SQLException
Get pooled connection. This method will block until there will be free connection to return.
- Overrides:
- getPooledConnection in interface BasicAbstractConnectionPool
- Returns:
- instance of
PooledConnection
.
public PooledConnection getPooledConnection(String user, String password) throws SQLException
Get pooled connection for the specified user name and password.
- Overrides:
- getPooledConnection in interface BasicAbstractConnectionPool
- Parameters:
user
- user name.password
- password corresponding to specified user name.
- Returns:
- instance of
PooledConnection
for the specified credentials.
protected PooledObject getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue) throws SQLException
Get pooled connection from the pooled queue.
- Overrides:
- getPooledConnection in interface AbstractConnectionPool
public String getRoleName()
- Specified by:
- getRoleName in interface FirebirdConnectionProperties
public int getSocketBufferSize()
- Specified by:
- getSocketBufferSize in interface FirebirdConnectionProperties
public String getSqlDialect()
- Specified by:
- getSqlDialect in interface FirebirdConnectionProperties
public int getTotalSize() throws SQLException
- Specified by:
- getTotalSize in interface FirebirdPool
- Overrides:
- getTotalSize in interface AbstractConnectionPool
public String getTpbMapping()
- Specified by:
- getTpbMapping in interface FirebirdConnectionProperties
public TransactionParameterBuffer getTransactionParameters(int isolation)
- Specified by:
- getTransactionParameters in interface FirebirdConnectionProperties
public String getType()
Get type of JDBC driver that will be used. Note, value returned by this method might be different from that used insetType(String)
if you used synonym (either"TYPE4"
or"TYPE2"
).
- Specified by:
- getType in interface FirebirdConnectionProperties
- Returns:
- one of the following values:
"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 String getUseTranslation()
- Specified by:
- getUseTranslation in interface FirebirdConnectionProperties
public String getUserName()
- Specified by:
- getUserName in interface FirebirdConnectionProperties
public int getWorkingSize() throws SQLException
- Specified by:
- getWorkingSize in interface FirebirdPool
- Overrides:
- getWorkingSize in interface AbstractConnectionPool
public XAConnection getXAConnection() throws SQLException
Get XA connection. This method will block until there will be free connection to return.
- Returns:
- instance of
XAConnection
.
public XAConnection getXAConnection(String user, String password) throws SQLException
Get XA connection for the specified user name and password.
- Parameters:
user
- user name.password
- password corresponding to specified user name.
- Returns:
- instance of
XAConnection
for the specified credentials.
public boolean isDefaultResultSetHoldable()
- Specified by:
- isDefaultResultSetHoldable in interface FirebirdConnectionProperties
public boolean isPingable()
Check if this configuation defines a pingable connection JDBC pool.
- Specified by:
- isPingable in interface ConnectionPoolConfiguration
- Overrides:
- isPingable in interface BasicAbstractConnectionPool
public boolean isTimestampUsesLocalTimezone()
- Specified by:
- isTimestampUsesLocalTimezone in interface FirebirdConnectionProperties
public boolean isUseStandardUdf()
- Specified by:
- isUseStandardUdf in interface FirebirdConnectionProperties
public boolean isUseStreamBlobs()
- Specified by:
- isUseStreamBlobs in interface FirebirdConnectionProperties
public void physicalConnectionClosed(ConnectionEvent connectionEvent)
Notify about physical connection being closed.
- Specified by:
- physicalConnectionClosed in interface PooledConnectionEventListener
- Parameters:
connectionEvent
- instance ofConnectionEvent
.
public void physicalConnectionDeallocated(ConnectionEvent connectionEvent)
Notify about the deallocation of the physical connection.
- Specified by:
- physicalConnectionDeallocated in interface PooledConnectionEventListener
- Parameters:
connectionEvent
- instance ofConnectionEvent
.
protected Object processObjectInstance(AbstractFBConnectionPoolDataSource ds, Reference ref) throws Exception
public void setBlobBufferSize(int blobBufferSize)
- Specified by:
- setBlobBufferSize in interface FirebirdConnectionProperties
public void setBuffersNumber(int buffersNumber)
- Specified by:
- setBuffersNumber in interface FirebirdConnectionProperties
public void setCharSet(String charSet)
- Specified by:
- setCharSet in interface FirebirdConnectionProperties
public void setConnectionProperties(FBConnectionProperties props)
Set the connection properties in bulk. This method replaces the instance created in constructor, therefore, if the managed connection factory was already initialized with that instance, change will not be visible to it. In this case appropriate exception is thrown.
- Parameters:
props
- instance ofFBConnectionProperties
.
public void setDatabase(String database)
- Specified by:
- setDatabase in interface FirebirdConnectionProperties
public void setDefaultIsolation(String isolation)
- Specified by:
- setDefaultIsolation in interface FirebirdConnectionProperties
public void setDefaultResultSetHoldable(boolean isHoldable)
- Specified by:
- setDefaultResultSetHoldable in interface FirebirdConnectionProperties
public void setDefaultTransactionIsolation(int defaultIsolationLevel)
- Specified by:
- setDefaultTransactionIsolation in interface FirebirdConnectionProperties
public void setEncoding(String encoding)
- Specified by:
- setEncoding in interface FirebirdConnectionProperties
public void setGDSType(org.firebirdsql.gds.impl.GDSType gdsType)
Set type of the JDBC driver to use.
- Parameters:
gdsType
- type of the JDBC driver.
public void setLogWriter(PrintWriter out)
- Overrides:
- setLogWriter in interface BasicAbstractConnectionPool
public void setLoginTimeout(int seconds)
Set login timeout for new connection. Currently ignored.
- Overrides:
- setLoginTimeout in interface BasicAbstractConnectionPool
- Parameters:
seconds
- how long pool should wait until new connection is granted.
public void setNonStandardProperty(String propertyMapping)
Method that allows setting non-standard property in the form "key=value" form. This method is needed by some containers to specify properties in the configuration.
- Specified by:
- setNonStandardProperty in interface FirebirdConnectionProperties
- Parameters:
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 void setNonStandardProperty(String key, String value)
- Specified by:
- setNonStandardProperty in interface FirebirdConnectionProperties
public void setPassword(String password)
- Specified by:
- setPassword in interface FirebirdConnectionProperties
public void setProperties(Properties properties)
Set JDBC properties that will be passed when opening a connection.
- Parameters:
properties
- instance ofProperties
containing properties of a connection to open.
public void setRoleName(String roleName)
- Specified by:
- setRoleName in interface FirebirdConnectionProperties
public void setSocketBufferSize(int socketBufferSize)
- Specified by:
- setSocketBufferSize in interface FirebirdConnectionProperties
public void setSqlDialect(String sqlDialect)
- Specified by:
- setSqlDialect in interface FirebirdConnectionProperties
public void setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
- Specified by:
- setTimestampUsesLocalTimezone in interface FirebirdConnectionProperties
public void setTpbMapping(String tpbMapping)
- Specified by:
- setTpbMapping in interface FirebirdConnectionProperties
public void setTransactionParameters(int isolation, TransactionParameterBuffer tpb)
- Specified by:
- setTransactionParameters in interface FirebirdConnectionProperties
public void setType(String type)
Set type of JDBC driver to use.
- Specified by:
- setType in interface FirebirdConnectionProperties
- Parameters:
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.
public void setUseStandardUdf(boolean useStandardUdf)
- Specified by:
- setUseStandardUdf in interface FirebirdConnectionProperties
public void setUseStreamBlobs(boolean useStreamBlobs)
- Specified by:
- setUseStreamBlobs in interface FirebirdConnectionProperties
public void setUseTranslation(String translationPath)
- Specified by:
- setUseTranslation in interface FirebirdConnectionProperties
public void setUserName(String userName)
- Specified by:
- setUserName in interface FirebirdConnectionProperties