|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.firebirdsql.pool.FBWrappingDataSource
public class 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()
Get time during which ConnectionPoolDataSource.getPooledConnection()
can block. |
int |
getBuffersNumber()
|
String |
getCharSet()
|
Connection |
getConnection()
Get JDBC connection from this data source. |
Connection |
getConnection(String user,
String password)
Get JDBC connection for the specified user name and password. |
int |
getConnectionCount()
Deprecated. Confusing name. Use getFreeSize() instead. |
String |
getDatabase()
|
DatabaseParameterBuffer |
getDatabaseParameterBuffer()
Get the database parameter buffer corresponding to the current connection request information. |
String |
getDefaultIsolation()
Get the default transaction isolation level as string. |
Reference |
getDefaultReference()
Get default JNDI reference for this datasource. |
int |
getDefaultTransactionIsolation()
Get the default transaction isolation level. |
String |
getDescription()
|
String |
getEncoding()
|
int |
getFreeSize()
|
int |
getIdleTimeout()
Deprecated. non-standard name, use getMaxIdleTime(). |
String |
getIsolation()
Deprecated. Use getDefaultIsolation() instead. |
int |
getLoginTimeout()
Get login timeout. |
PrintWriter |
getLogWriter()
Get log writer. |
int |
getMaxConnections()
Deprecated. non-standard name, use getMaxPoolSize(). |
int |
getMaxIdleTime()
Get time after which idle connections will be deallocated. |
int |
getMaxPoolSize()
Get maximum number of physical connections that can be simultaneously open. |
int |
getMaxStatements()
|
int |
getMinConnections()
Deprecated. non-standard name, use getMinPoolSize() |
int |
getMinPoolSize()
Get minimum number of open JDBC connections that will be created when pool is started. |
String |
getNonStandardProperty(String key)
Get the property that does not have corresponding getter method by its name. |
Object |
getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable environment)
Get object instance for the specified name in the specified context. |
String |
getPassword()
|
int |
getPingInterval()
Get time interval after which connection should be pinged. |
String |
getPingStatement()
Get SQL statement that will be used to ping connection. |
boolean |
getPooling()
Deprecated. use isPooling() method. |
Reference |
getReference()
Get JDNI reference. |
int |
getRetryInterval()
Get interval of getting connections retries. |
String |
getRoleName()
|
int |
getSocketBufferSize()
|
String |
getSqlDialect()
|
String |
getSqlRole()
Deprecated. please use getRoleName() instead. |
int |
getTotalSize()
|
String |
getTpbMapping()
Get the used TPB mapping. |
int |
getTransactionIsolationLevel()
Deprecated. Use getDefaultTransactionIsolation() instead. |
TransactionParameterBuffer |
getTransactionParameters(int isolation)
Get the transaction parameter buffer corresponding to the current connection request information. |
String |
getType()
|
String |
getUserName()
|
String |
getUseTranslation()
|
int |
getWorkingSize()
|
boolean |
isDefaultResultSetHoldable()
|
boolean |
isKeepStatements()
|
boolean |
isPingable()
Check if this pool supports pingable connections. |
boolean |
isPooling()
Check if this connection pool uses connection pooling, or just implements JDBC 2.0 SE interfaces. |
boolean |
isStatementPooling()
Check if this connection pool provides also prepared statement pooling. |
boolean |
isTimestampUsesLocalTimezone()
|
boolean |
isUseStandardUdf()
|
boolean |
isUseStreamBlobs()
|
boolean |
isWrapperFor(Class arg0)
|
void |
restart()
|
void |
setBlobBufferSize(int bufferSize)
|
void |
setBlockingTimeout(int blockingTimeoutValue)
|
void |
setBuffersNumber(int buffersNumber)
|
void |
setCharSet(String charSet)
|
void |
setDatabase(String database)
|
void |
setDefaultIsolation(String isolation)
Set the default transaction isolation level as string. |
void |
setDefaultResultSetHoldable(boolean isHoldable)
|
void |
setDefaultTransactionIsolation(int defaultIsolationLevel)
Set the default transaction isolation level. |
void |
setDescription(String descriptionValue)
|
void |
setEncoding(String encoding)
|
void |
setIdleTimeout(int idleTimeoutValue)
Deprecated. non-standard name, use setMaxIdleTime(int). |
void |
setIsolation(String isolation)
Deprecated. Use setDefaultIsolation(String) instead. |
void |
setKeepStatements(boolean keepStatements)
|
void |
setLoginTimeout(int seconds)
Set login timeout. |
void |
setLogWriter(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(String propertyMapping)
Set the property that does not have corresponding setter method. |
void |
setNonStandardProperty(String key,
String value)
Set the property that does not have corresponding setter method. |
void |
setPassword(String password)
|
void |
setPingInterval(int pingIntervalValue)
|
void |
setPingStatement(String pingStatement)
|
void |
setPooling(boolean pooling)
|
void |
setProperties(Properties props)
|
void |
setReference(Reference reference)
Set JNDI reference for this data source. |
void |
setRetryInterval(int retryInterval)
|
void |
setRoleName(String roleName)
|
void |
setSocketBufferSize(int socketBufferSize)
|
void |
setSqlDialect(String sqlDialect)
|
void |
setSqlRole(String sqlRole)
Deprecated. please use setRoleName(String) instead. |
void |
setStatementPooling(boolean statementPooling)
|
void |
setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
|
void |
setTpbMapping(String tpbMapping)
Set path to the properties file with the TPB mapping. |
void |
setTransactionIsolationLevel(int level)
Deprecated. Use setDefaultTransactionIsolation(int) instead. |
void |
setTransactionParameters(int isolation,
TransactionParameterBuffer tpb)
Set transaction parameters for the specified transaction isolation level. |
void |
setType(String type)
|
void |
setUserName(String userName)
|
void |
setUseStandardUdf(boolean useStandardUdf)
|
void |
setUseStreamBlobs(boolean useStreamBlobs)
|
void |
setUseTranslation(String translationPath)
|
void |
shutdown()
|
Object |
unwrap(Class arg0)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FBWrappingDataSource()
| Method Detail |
|---|
protected void finalize()
throws Throwable
finalize in class ObjectThrowable - if something went wrong.public void restart()
restart in interface FirebirdPoolpublic void shutdown()
shutdown in interface FirebirdPool
public Connection getConnection()
throws SQLException
getConnection in interface DataSourceConnection.
SQLException - if connection cannot be obtained due to some reason.
public Connection getConnection(String user,
String password)
throws SQLException
getConnection in interface DataSourceSQLException - if something went wrong.public int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcepublic PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourcePrintWriter.public void setLoginTimeout(int seconds)
setLoginTimeout in interface CommonDataSourceseconds - login timeout.public void setLogWriter(PrintWriter printWriter)
setLogWriter in interface CommonDataSourceprintWriter - instance of PrintWriter.public int getBlockingTimeout()
ConnectionPoolConfigurationConnectionPoolDataSource.getPooledConnection()
can block. By default method blocks forever.
getBlockingTimeout in interface ConnectionPoolConfigurationgetBlockingTimeout in interface FirebirdPoolInteger.MAX_VALUE
indicates blocking forever.public void setBlockingTimeout(int blockingTimeoutValue)
setBlockingTimeout in interface FirebirdPoolpublic String getDescription()
public void setDescription(String descriptionValue)
public int getMaxIdleTime()
ConnectionPoolConfiguration
getMaxIdleTime in interface ConnectionPoolConfigurationgetMaxIdleTime in interface FirebirdPoolInteger.MAX_VALUE
indicates that idle connections are not removed.public void setMaxIdleTime(int maxIdleTime)
setMaxIdleTime in interface FirebirdPoolpublic int getIdleTimeout()
getMaxIdleTime().
ConnectionPoolConfiguration
getIdleTimeout in interface ConnectionPoolConfigurationInteger.MAX_VALUE
indicates that idle connections are not removed.public void setIdleTimeout(int idleTimeoutValue)
setMaxIdleTime(int).
public int getMaxStatements()
getMaxStatements in interface FirebirdPoolpublic void setMaxStatements(int maxStatements)
setMaxStatements in interface FirebirdPoolpublic int getMaxPoolSize()
ConnectionPoolConfiguration
getMaxPoolSize in interface ConnectionPoolConfigurationgetMaxPoolSize in interface FirebirdPoolpublic void setMaxPoolSize(int maxPoolSize)
setMaxPoolSize in interface FirebirdPoolpublic int getMaxConnections()
getMaxPoolSize().
ConnectionPoolConfiguration
getMaxConnections in interface ConnectionPoolConfigurationpublic void setMaxConnections(int maxConnections)
setMaxPoolSize(int).
public int getMinPoolSize()
ConnectionPoolConfiguration
getMinPoolSize in interface ConnectionPoolConfigurationgetMinPoolSize in interface FirebirdPoolpublic void setMinPoolSize(int minPoolSize)
setMinPoolSize in interface FirebirdPoolpublic int getMinConnections()
getMinPoolSize()
ConnectionPoolConfiguration
getMinConnections in interface ConnectionPoolConfigurationpublic void setMinConnections(int minConnections)
setMinPoolSize(int)
public boolean isKeepStatements()
public void setKeepStatements(boolean keepStatements)
public int getPingInterval()
ConnectionPoolConfiguration
getPingInterval in interface ConnectionPoolConfigurationgetPingInterval in interface FirebirdPoolpublic void setPingInterval(int pingIntervalValue)
setPingInterval in interface FirebirdPoolpublic String getPingStatement()
ConnectionPoolConfigurationExamples of ping SQL statements:
"SELECT CAST(1 AS INTEGER) FROM DUAL"
"SELECT CAST(1 AS INTEGER) FROM RDB$DATABASE"
getPingStatement in interface ConnectionPoolConfigurationpublic void setPingStatement(String pingStatement)
public int getRetryInterval()
ConnectionPoolConfiguration
getRetryInterval in interface ConnectionPoolConfigurationpublic void setRetryInterval(int retryInterval)
public boolean isPingable()
ConnectionPoolConfiguration
isPingable in interface ConnectionPoolConfigurationtrue if this pool supports pingable connections.public String getSqlRole()
getRoleName() instead.
public void setSqlRole(String sqlRole)
setRoleName(String) instead.
public boolean getPooling()
isPooling() method.
public boolean isPooling()
ConnectionPoolConfigurationjava.sql.Driver.
isPooling in interface ConnectionPoolConfigurationisPooling in interface FirebirdPooltrue if pooling is enabled.public void setPooling(boolean pooling)
setPooling in interface FirebirdPoolpublic boolean isStatementPooling()
ConnectionPoolConfiguration
isStatementPooling in interface ConnectionPoolConfigurationisStatementPooling in interface FirebirdPooltrue if prepared statement pooling is enabled.public void setStatementPooling(boolean statementPooling)
setStatementPooling in interface FirebirdPool
public int getConnectionCount()
throws SQLException
getFreeSize() instead.
SQLException
public int getFreeSize()
throws SQLException
getFreeSize in interface FirebirdPoolSQLException
public int getWorkingSize()
throws SQLException
getWorkingSize in interface FirebirdPoolSQLException
public int getTotalSize()
throws SQLException
getTotalSize in interface FirebirdPoolSQLExceptionpublic int getTransactionIsolationLevel()
getDefaultTransactionIsolation() instead.
public void setTransactionIsolationLevel(int level)
setDefaultTransactionIsolation(int) instead.
public String getIsolation()
getDefaultIsolation() instead.
public void setIsolation(String isolation)
throws SQLException
setDefaultIsolation(String) instead.
SQLExceptionpublic void setProperties(Properties props)
public int getBlobBufferSize()
getBlobBufferSize in interface FirebirdConnectionPropertiespublic int getBuffersNumber()
getBuffersNumber in interface FirebirdConnectionPropertiespublic String getCharSet()
getCharSet in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setCharSet(String)public String getDatabase()
getDatabase in interface FirebirdConnectionProperties
public DatabaseParameterBuffer getDatabaseParameterBuffer()
throws SQLException
FirebirdConnectionProperties
getDatabaseParameterBuffer in interface FirebirdConnectionPropertiesDatabaseParameterBuffer.
SQLException - if database parameter buffer cannot be created.public String getDefaultIsolation()
FirebirdConnectionPropertiesFirebirdConnectionProperties.getDefaultTransactionIsolation(), however
it takes a string as parameter instead of a numeric constant.
getDefaultIsolation in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setDefaultIsolation(String)public int getDefaultTransactionIsolation()
FirebirdConnectionProperties
getDefaultTransactionIsolation in interface FirebirdConnectionPropertiespublic String getEncoding()
getEncoding in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setEncoding(String)public String getNonStandardProperty(String key)
FirebirdConnectionProperties
getNonStandardProperty in interface FirebirdConnectionPropertieskey - name of the property to get.
public String getPassword()
getPassword in interface FirebirdConnectionPropertiespublic String getRoleName()
getRoleName in interface FirebirdConnectionPropertiespublic int getSocketBufferSize()
getSocketBufferSize in interface FirebirdConnectionPropertiespublic String getSqlDialect()
getSqlDialect in interface FirebirdConnectionPropertiespublic String getTpbMapping()
FirebirdConnectionProperties
getTpbMapping in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setTpbMapping(String)public TransactionParameterBuffer getTransactionParameters(int isolation)
FirebirdConnectionProperties
getTransactionParameters in interface FirebirdConnectionPropertiesisolation - transaction isolation level for which TPB should be returned.
TransactionParameterBuffer.public String getType()
getType in interface FirebirdConnectionPropertiespublic String getUserName()
getUserName in interface FirebirdConnectionPropertiespublic String getUseTranslation()
getUseTranslation in interface FirebirdConnectionPropertiespublic boolean isTimestampUsesLocalTimezone()
isTimestampUsesLocalTimezone in interface FirebirdConnectionPropertiestrue if the Jaybird 1.0 handling of the calendar
in corresponding setters. This is also compatible with MySQL
calendar treatment.public boolean isUseStandardUdf()
isUseStandardUdf in interface FirebirdConnectionPropertiestrue if driver should assume that standard UDF are
installed.public boolean isUseStreamBlobs()
isUseStreamBlobs in interface FirebirdConnectionPropertiestrue if stream blobs should be created, otherwise
false.public void setBlobBufferSize(int bufferSize)
setBlobBufferSize in interface FirebirdConnectionPropertiesbufferSize - size of the BLOB buffer in bytes.public void setBuffersNumber(int buffersNumber)
setBuffersNumber in interface FirebirdConnectionPropertiesbuffersNumber - number of cache buffers that should be allocated for this
connection, should be specified for ClassicServer instances,
SuperServer has a server-wide configuration parameter.public void setCharSet(String charSet)
setCharSet in interface FirebirdConnectionPropertiescharSet - Character set for the connection. Similar to
encoding property, but accepts Java names
instead of Firebird ones.public void setDatabase(String database)
setDatabase in interface FirebirdConnectionPropertiesdatabase - path to the database including the server name and the
port, if needed.public void setDefaultIsolation(String isolation)
FirebirdConnectionPropertiesFirebirdConnectionProperties.setDefaultTransactionIsolation(int),
however it takes a string as parameter instead of a numeric constant.
Following strings are allowed:
"TRANSACTION_READ_COMMITTED" for a READ COMMITTED
isolation level.
"TRANSACTION_REPEATABLE_READ" for a REPEATABLE READ
isolation level.
"TRANSACTION_SERIALIZABLE" for a SERIALIZABLE
isolation level.
setDefaultIsolation in interface FirebirdConnectionPropertiesisolation - string constant representing a default isolation level.public void setDefaultTransactionIsolation(int defaultIsolationLevel)
FirebirdConnectionProperties
setDefaultTransactionIsolation in interface FirebirdConnectionPropertiesdefaultIsolationLevel - default transaction isolation level.public void setEncoding(String encoding)
setEncoding in interface FirebirdConnectionPropertiesencoding - Character encoding for the connection. See Firebird
documentation for more information.
public void setNonStandardProperty(String key,
String value)
FirebirdConnectionProperties
setNonStandardProperty in interface FirebirdConnectionPropertieskey - name of the property to set.value - value of the property.public void setNonStandardProperty(String propertyMapping)
FirebirdConnectionProperties
setNonStandardProperty in interface FirebirdConnectionPropertiespropertyMapping - parameter value in the ?propertyName[=propertyValue]? form,
this allows setting non-standard parameters using
configuration files.public void setPassword(String password)
setPassword in interface FirebirdConnectionPropertiespassword - password corresponding to the specified user name.public void setRoleName(String roleName)
setRoleName in interface FirebirdConnectionPropertiesroleName - SQL role to use.public void setSocketBufferSize(int socketBufferSize)
setSocketBufferSize in interface FirebirdConnectionPropertiessocketBufferSize - socket buffer size in bytes.public void setSqlDialect(String sqlDialect)
setSqlDialect in interface FirebirdConnectionPropertiessqlDialect - SQL dialect of the client.public void setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
setTimestampUsesLocalTimezone in interface FirebirdConnectionPropertiestimestampUsesLocalTimezone - true if the Jaybird 1.0 handling of the
calendar in corresponding setters. This is also compatible
with MySQL calendar treatment.public void setTpbMapping(String tpbMapping)
FirebirdConnectionProperties"res:" should be used to specify resource
in the classpath.
For the compatibility reasons, if no protocol is specified, classpath is used by default.
Properties file contains a mapping between the transaction isolation
level (name of the constant in the Connection interface
and a comma-separated list of TPB parameters.
setTpbMapping in interface FirebirdConnectionPropertiestpbMapping - path to the properties file.
public void setTransactionParameters(int isolation,
TransactionParameterBuffer tpb)
FirebirdConnectionProperties
setTransactionParameters in interface FirebirdConnectionPropertiesisolation - transaction isolation level.tpb - instance of TransactionParameterBuffer containing
transaction parameters.public void setType(String type)
setType in interface FirebirdConnectionPropertiestype - type of the connection, for example, "PURE_JAVA", "LOCAL",
"EMBEDDED", depends on the GDS implementations installed in the system.public void setUserName(String userName)
setUserName in interface FirebirdConnectionPropertiesuserName - name of the user that will be used when connecting to the
database.public void setUseStandardUdf(boolean useStandardUdf)
setUseStandardUdf in interface FirebirdConnectionPropertiesuseStandardUdf - true if driver should assume that standard UDF
are installed.public void setUseStreamBlobs(boolean useStreamBlobs)
setUseStreamBlobs in interface FirebirdConnectionPropertiesuseStreamBlobs - true if stream blobs should be created,
otherwise false.public void setUseTranslation(String translationPath)
setUseTranslation in interface FirebirdConnectionPropertiestranslationPath - path to the character translation table.public boolean isDefaultResultSetHoldable()
isDefaultResultSetHoldable in interface FirebirdConnectionPropertiespublic void setDefaultResultSetHoldable(boolean isHoldable)
setDefaultResultSetHoldable in interface FirebirdConnectionProperties
public Object getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable environment)
throws Exception
obj represents
Reference, whose factory class is equal to this class.
getObjectInstance in interface ObjectFactoryExceptionpublic Reference getReference()
getReference in interface ReferenceableReference.public void setReference(Reference reference)
reference - JNDI reference.public Reference getDefaultReference()
Reference containing all information
that allows to reconstruct the datasource.
public boolean isWrapperFor(Class arg0)
throws SQLException
isWrapperFor in interface WrapperSQLException
public Object unwrap(Class arg0)
throws SQLException
unwrap in interface WrapperSQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||