|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.firebirdsql.pool.FBWrappingDataSource
Implementation of DataSource
including connection pooling.
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.
roleName
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).
Constructor Summary | |
FBWrappingDataSource()
Create instance of this class. |
Method Summary | |
protected void |
finalize()
Finalize this instance. |
int |
getBlobBufferSize()
|
int |
getBlockingTimeout()
|
java.lang.String |
getCharSet()
|
java.sql.Connection |
getConnection()
Get JDBC connection from this data source. |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Get JDBC connection for the specified user name and password. |
int |
getConnectionCount()
Deprecated. Confusing name. Use getFreeSize() instead. |
java.lang.String |
getDatabase()
|
javax.naming.Reference |
getDefaultReference()
Get default JNDI reference for this datasource. |
java.lang.String |
getDescription()
|
java.lang.String |
getEncoding()
|
int |
getFreeSize()
|
int |
getIdleTimeout()
Deprecated. non-standard name, use getMaxIdleTime() . |
java.lang.String |
getIsolation()
|
int |
getLoginTimeout()
Get login timeout. |
java.io.PrintWriter |
getLogWriter()
Get log writer. |
int |
getMaxConnections()
Deprecated. non-standard name, use getMaxPoolSize() . |
int |
getMaxIdleTime()
|
int |
getMaxPoolSize()
|
int |
getMaxStatements()
|
int |
getMinConnections()
Deprecated. non-standard name, use getMinPoolSize() |
int |
getMinPoolSize()
|
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()
|
boolean |
getPooling()
Deprecated. use isPooling() method. |
javax.naming.Reference |
getReference()
Get JDNI reference. |
java.lang.String |
getRoleName()
|
int |
getSocketBufferSize()
|
java.lang.String |
getSqlRole()
Deprecated. please use getRoleName() instead. |
int |
getTotalSize()
|
java.lang.String |
getTpbMapping()
|
int |
getTransactionIsolationLevel()
|
java.lang.String |
getType()
|
java.lang.String |
getUserName()
|
int |
getWorkingSize()
|
boolean |
isKeepStatements()
|
boolean |
isPooling()
|
boolean |
isStatementPooling()
|
void |
setBlobBufferSize(int blobBufferSizeValue)
|
void |
setBlockingTimeout(int blockingTimeoutValue)
|
void |
setCharSet(java.lang.String charSet)
|
void |
setDatabase(java.lang.String databaseValue)
|
void |
setDescription(java.lang.String descriptionValue)
|
void |
setEncoding(java.lang.String encodingValue)
|
void |
setIdleTimeout(int idleTimeoutValue)
Deprecated. non-standard name, use setMaxIdleTime(int) . |
void |
setIsolation(java.lang.String isolation)
|
void |
setKeepStatements(boolean keepStatements)
|
void |
setLoginTimeout(int seconds)
Set login timeout. |
void |
setLogWriter(java.io.PrintWriter printWriter)
Set log writer. |
void |
setMaxConnections(int maxConnections)
Deprecated. non-standard name, use setMaxPoolSize(int) . |
void |
setMaxIdleTime(int maxIdleTime)
|
void |
setMaxPoolSize(int maxPoolSize)
|
void |
setMaxStatements(int maxStatements)
|
void |
setMinConnections(int minConnections)
Deprecated. non-standard name, use setMinPoolSize(int) |
void |
setMinPoolSize(int minPoolSize)
|
void |
setNonStandardProperty(java.lang.String propertyMapping)
|
void |
setNonStandardProperty(java.lang.String key,
java.lang.String value)
|
void |
setPassword(java.lang.String passwordValue)
|
void |
setPingInterval(int pingIntervalValue)
|
void |
setPooling(boolean pooling)
|
void |
setProperties(java.util.Properties props)
|
void |
setReference(javax.naming.Reference reference)
Set JNDI reference for this data source. |
void |
setRoleName(java.lang.String roleName)
|
void |
setSocketBufferSize(int socketBufferSize)
|
void |
setSqlRole(java.lang.String sqlRole)
Deprecated. please use setRoleName(String) instead. |
void |
setStatementPooling(boolean statementPooling)
|
void |
setTpbMapping(java.lang.String tpbMappingValue)
|
void |
setTransactionIsolationLevel(int level)
|
void |
setType(java.lang.String typeValue)
|
void |
setUserName(java.lang.String userNameValue)
|
void |
shutdown()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FBWrappingDataSource() throws java.sql.SQLException
Method Detail |
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
- if something went wrong.public void shutdown()
shutdown
in interface FirebirdPool
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
Connection
.
java.sql.SQLException
- if connection cannot be obtained due to some reason.public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if something went wrong.public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.DataSource
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.DataSource
PrintWriter
.public void setLoginTimeout(int seconds)
setLoginTimeout
in interface javax.sql.DataSource
seconds
- login timeout.public void setLogWriter(java.io.PrintWriter printWriter)
setLogWriter
in interface javax.sql.DataSource
printWriter
- instance of PrintWriter
.public int getBlockingTimeout()
getBlockingTimeout
in interface FirebirdPool
public void setBlockingTimeout(int blockingTimeoutValue)
setBlockingTimeout
in interface FirebirdPool
public java.lang.String getDatabase()
getDatabase
in interface FirebirdPool
public void setDatabase(java.lang.String databaseValue)
setDatabase
in interface FirebirdPool
public java.lang.String getDescription()
public void setDescription(java.lang.String descriptionValue)
public java.lang.String getEncoding()
getEncoding
in interface FirebirdPool
public void setEncoding(java.lang.String encodingValue)
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 int getMaxIdleTime()
getMaxIdleTime
in interface FirebirdPool
public void setMaxIdleTime(int maxIdleTime)
setMaxIdleTime
in interface FirebirdPool
public int getIdleTimeout()
getMaxIdleTime()
.
public void setIdleTimeout(int idleTimeoutValue)
setMaxIdleTime(int)
.
public int getMaxStatements()
getMaxStatements
in interface FirebirdPool
public void setMaxStatements(int maxStatements)
setMaxStatements
in interface FirebirdPool
public int getMaxPoolSize()
getMaxPoolSize
in interface FirebirdPool
public void setMaxPoolSize(int maxPoolSize)
setMaxPoolSize
in interface FirebirdPool
public int getMaxConnections()
getMaxPoolSize()
.
public void setMaxConnections(int maxConnections)
setMaxPoolSize(int)
.
public int getMinPoolSize()
getMinPoolSize
in interface FirebirdPool
public void setMinPoolSize(int minPoolSize)
setMinPoolSize
in interface FirebirdPool
public int getMinConnections()
getMinPoolSize()
public void setMinConnections(int minConnections)
setMinPoolSize(int)
public boolean isKeepStatements()
public void setKeepStatements(boolean keepStatements)
public java.lang.String getPassword()
getPassword
in interface FirebirdPool
public void setPassword(java.lang.String passwordValue)
setPassword
in interface FirebirdPool
public java.lang.String getTpbMapping()
getTpbMapping
in interface FirebirdPool
public void setTpbMapping(java.lang.String tpbMappingValue)
setTpbMapping
in interface FirebirdPool
public java.lang.String getUserName()
getUserName
in interface FirebirdPool
public void setUserName(java.lang.String userNameValue)
setUserName
in interface FirebirdPool
public int getBlobBufferSize()
getBlobBufferSize
in interface FirebirdPool
public void setBlobBufferSize(int blobBufferSizeValue)
setBlobBufferSize
in interface FirebirdPool
public java.lang.String getType()
getType
in interface FirebirdPool
public void setType(java.lang.String typeValue) throws java.sql.SQLException
setType
in interface FirebirdPool
java.sql.SQLException
public int getPingInterval()
getPingInterval
in interface FirebirdPool
public void setPingInterval(int pingIntervalValue)
setPingInterval
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 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
public boolean getPooling()
isPooling()
method.
public boolean isPooling()
isPooling
in interface FirebirdPool
public void setPooling(boolean pooling)
setPooling
in interface FirebirdPool
public boolean isStatementPooling()
isStatementPooling
in interface FirebirdPool
public void setStatementPooling(boolean statementPooling)
setStatementPooling
in interface FirebirdPool
public int getConnectionCount() throws java.sql.SQLException
getFreeSize()
instead.
java.sql.SQLException
public int getFreeSize() throws java.sql.SQLException
getFreeSize
in interface FirebirdPool
java.sql.SQLException
public int getWorkingSize() throws java.sql.SQLException
getWorkingSize
in interface FirebirdPool
java.sql.SQLException
public int getTotalSize() throws java.sql.SQLException
getTotalSize
in interface FirebirdPool
java.sql.SQLException
public int getTransactionIsolationLevel()
getTransactionIsolationLevel
in interface FirebirdPool
public void setTransactionIsolationLevel(int level)
setTransactionIsolationLevel
in interface FirebirdPool
public java.lang.String getIsolation()
getIsolation
in interface FirebirdPool
public void setIsolation(java.lang.String isolation) throws java.sql.SQLException
setIsolation
in interface FirebirdPool
java.sql.SQLException
public void setProperties(java.util.Properties props)
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 |