public class FBSimpleDataSource extends AbstractConnectionPropertiesDataSource implements javax.sql.DataSource, java.io.Serializable, javax.naming.Referenceable
DataSource interface. Connections
are physically opened in DataSource.getConnection() method and
physically closed in Connection.close() method.
If you need a standalone connection pool, consider using a connection pool implementation like HikariCP, c3p0 or DBCP.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
description |
protected FBDataSource |
ds |
protected FBManagedConnectionFactory |
mcf |
| Constructor and Description |
|---|
FBSimpleDataSource()
Creates an instance using the default GDS type (PURE_JAVA).
|
FBSimpleDataSource(GDSType type)
Creates an instance using the specified GDS type.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<ConnectionProperty,java.lang.Object> |
connectionPropertyValues()
An unmodifiable view on the connection properties held by this BaseProperties implementation.
|
java.lang.Integer |
getBlobBufferLength()
Deprecated.
Use
AbstractConnectionPropertiesDataSource.getBlobBufferSize(); will be removed in Jaybird 6 |
java.lang.Boolean |
getBooleanProperty(java.lang.String name)
Retrieves a
boolean property value by name. |
java.sql.Connection |
getConnection()
Get JDBC connection with default credentials.
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Get JDBC connection with the specified credentials.
|
protected javax.sql.DataSource |
getDataSource()
Get underlying connection factory (in our case instance of
FBDataSource class) that will provide JDBC
connections. |
java.lang.String |
getDescription()
Get description of this datasource.
|
java.lang.Integer |
getIntProperty(java.lang.String name)
Retrieves an
int property value by name. |
java.lang.String |
getProperty(java.lang.String name)
Retrieves a string property value by name.
|
javax.naming.Reference |
getReference() |
TransactionParameterBuffer |
getTransactionParameters(int isolation)
Get the transaction parameter buffer corresponding to the current
connection request information.
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setBlobBufferLength(java.lang.Integer length)
Deprecated.
Use
AbstractConnectionPropertiesDataSource.setBlobBufferSize(int); will be removed in Jaybird 6 |
void |
setBooleanProperty(java.lang.String name,
java.lang.Boolean value)
Sets a
boolean property by name. |
void |
setDescription(java.lang.String description)
Set description of this datasource.
|
void |
setIntProperty(java.lang.String name,
java.lang.Integer value)
Sets an
int property by name. |
void |
setNonStandardProperty(java.lang.String propertyMapping)
Set the property that does not have corresponding setter method.
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets a property by name.
|
void |
setTransactionParameters(int isolation,
TransactionParameterBuffer tpb)
Set transaction parameters for the specified transaction isolation level.
|
<T> T |
unwrap(java.lang.Class<T> iface) |
getAuthPlugins, getBlobBufferSize, getBuffersNumber, getCharSet, getConnectTimeout, getDatabase, getDatabaseName, getDataTypeBind, getDbCryptConfig, getDecfloatRound, getDecfloatTraps, getDefaultIsolation, getDefaultTransactionIsolation, getEncoding, getGeneratedKeysEnabled, getLoginTimeout, getPageCacheSize, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getScrollableCursor, getServerBatchBufferSize, getServerName, getSessionTimeZone, getSocketBufferSize, getSoTimeout, getSqlDialect, getTpbMapping, getType, getUser, getUserName, getWireCrypt, isColumnLabelForName, isDefaultResultSetHoldable, isExtendedMetadata, isIgnoreProcedureType, isTimestampUsesLocalTimezone, isUseFirebirdAutocommit, isUseServerBatch, isUseStreamBlobs, isWireCompression, setAuthPlugins, setBlobBufferSize, setBuffersNumber, setCharSet, setColumnLabelForName, setConnectTimeout, setDatabase, setDatabaseName, setDataTypeBind, setDbCryptConfig, setDecfloatRound, setDecfloatTraps, setDefaultIsolation, setDefaultResultSetHoldable, setDefaultTransactionIsolation, setEncoding, setExtendedMetadata, setGeneratedKeysEnabled, setIgnoreProcedureType, setLoginTimeout, setPageCacheSize, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setScrollableCursor, setServerBatchBufferSize, setServerName, setSessionTimeZone, setSocketBufferSize, setSoTimeout, setSqlDialect, setTimestampUsesLocalTimezone, setTpbMapping, setType, setUseFirebirdAutocommit, setUser, setUserName, setUseServerBatch, setUseStreamBlobs, setWireCompression, setWireCryptgetLogWriter, getParentLogger, setLogWriterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWritergetNonStandardProperty, setNonStandardPropertygetBooleanProperty, getIntProperty, getPropertyprotected final FBManagedConnectionFactory mcf
protected transient FBDataSource ds
protected java.lang.String description
public FBSimpleDataSource()
public FBSimpleDataSource(GDSType type)
type - GDS type@Deprecated public java.lang.Integer getBlobBufferLength()
AbstractConnectionPropertiesDataSource.getBlobBufferSize(); will be removed in Jaybird 6@Deprecated public void setBlobBufferLength(java.lang.Integer length)
AbstractConnectionPropertiesDataSource.setBlobBufferSize(int); will be removed in Jaybird 6length - new length of the BLOB buffer.public TransactionParameterBuffer getTransactionParameters(int isolation)
FirebirdConnectionPropertiesgetTransactionParameters in interface FirebirdConnectionPropertiesisolation - transaction isolation level for which TPB should be returned.TransactionParameterBuffer.public void setTransactionParameters(int isolation,
TransactionParameterBuffer tpb)
FirebirdConnectionPropertiessetTransactionParameters in interface FirebirdConnectionPropertiesisolation - transaction isolation level.tpb - instance of TransactionParameterBuffer containing
transaction parameters.public void setNonStandardProperty(java.lang.String propertyMapping)
FirebirdConnectionPropertiessetNonStandardProperty in interface FirebirdConnectionPropertiespropertyMapping - parameter value in the propertyName[=propertyValue] form, this allows setting non-standard
parameters using configuration files.public java.lang.String getProperty(java.lang.String name)
BaseProperties
For properties with an explicit default, this method should return the string presentation of that default, not
null. For int or boolean the string equivalent is returned.
getProperty in interface BasePropertiesname - Property name (not null or empty)null when not set or not a known propertypublic void setProperty(java.lang.String name,
java.lang.String value)
BaseProperties
This method can be used to set all defined properties, but also properties not known by Jaybird. When setting
int or boolean properties, the appropriate conversions are applied. Using null will
reset to the default value. For boolean properties, an empty string is taken to mean true.
setProperty in interface BasePropertiesname - Property name (not null or empty)value - Property value (use null to apply default)public java.lang.Integer getIntProperty(java.lang.String name)
BasePropertiesint property value by name.
For properties with an explicit default, this method should return the integer presentation of that default. For
implementation simplicity, it is allowed to convert any string property to int instead of checking if
something is actually an int property
getIntProperty in interface BasePropertiesname - Property name (not null or empty)null when not setpublic void setIntProperty(java.lang.String name,
java.lang.Integer value)
BasePropertiesint property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setIntProperty in interface BasePropertiesname - Property name (not null or empty)value - Property value (use null to apply default)public java.lang.Boolean getBooleanProperty(java.lang.String name)
BasePropertiesboolean property value by name.
For properties with an explicit default, this method should return the boolean presentation of that default. For
implementation simplicity, it is allowed to convert any string property to boolean instead of checking
if something is actually an int property
getBooleanProperty in interface BasePropertiesname - Property name (not null or empty)null when not setpublic void setBooleanProperty(java.lang.String name,
java.lang.Boolean value)
BasePropertiesboolean property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setBooleanProperty in interface BasePropertiesname - Property name (not null or empty)value - Property value (use null to apply default)public java.util.Map<ConnectionProperty,java.lang.Object> connectionPropertyValues()
BaseProperties
Be aware, implementations can have additional properties that are not mapped from ConnectionProperty.
Such properties will need to be retrieved in an implementation-specific manner.
connectionPropertyValues in interface BasePropertiespublic javax.naming.Reference getReference()
throws javax.naming.NamingException
getReference in interface javax.naming.Referenceablejavax.naming.NamingExceptionpublic java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLException - if something went wrong.public java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourceusername - username for the connection.password - password for the connection.java.sql.SQLException - if something went wrong.public java.lang.String getDescription()
public void setDescription(java.lang.String description)
description - description of this datasource.protected javax.sql.DataSource getDataSource()
throws java.sql.SQLException
FBDataSource class) that will provide JDBC
connections.java.sql.SQLException - if something went wrong.public boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.