Class FBSimpleDataSource
- java.lang.Object
- 
- org.firebirdsql.ds.RootCommonDataSource
- 
- org.firebirdsql.ds.AbstractConnectionPropertiesDataSource
- 
- org.firebirdsql.ds.FBSimpleDataSource
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.sql.Wrapper,- javax.naming.Referenceable,- javax.sql.CommonDataSource,- javax.sql.DataSource,- AttachmentProperties,- BaseProperties,- DatabaseConnectionProperties,- FirebirdConnectionProperties
 
 public class FBSimpleDataSource extends AbstractConnectionPropertiesDataSource implements javax.sql.DataSource, java.io.Serializable, javax.naming.Referenceable This is a simple implementation ofDataSourceinterface. Connections are physically opened inDataSource.getConnection()method and physically closed inConnection.close()method.If you need a standalone connection pool, consider using a connection pool implementation like HikariCP, c3p0 or DBCP. - Author:
- Roman Rokytskyy, David Jencks
- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.Stringdescriptionprotected FBDataSourcedsprotected FBManagedConnectionFactorymcf
 - 
Constructor SummaryConstructors Constructor Description FBSimpleDataSource()Creates an instance using the default GDS type (PURE_JAVA).FBSimpleDataSource(GDSType type)Creates an instance using the specified GDS type.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Map<ConnectionProperty,java.lang.Object>connectionPropertyValues()An unmodifiable view on the connection properties held by this BaseProperties implementation.java.lang.IntegergetBlobBufferLength()Deprecated.UseAbstractConnectionPropertiesDataSource.getBlobBufferSize(); will be removed in Jaybird 6java.lang.BooleangetBooleanProperty(java.lang.String name)Retrieves abooleanproperty value by name.java.sql.ConnectiongetConnection()Get JDBC connection with default credentials.java.sql.ConnectiongetConnection(java.lang.String username, java.lang.String password)Get JDBC connection with the specified credentials.protected javax.sql.DataSourcegetDataSource()Get underlying connection factory (in our case instance ofFBDataSourceclass) that will provide JDBC connections.java.lang.StringgetDescription()Get description of this datasource.java.lang.IntegergetIntProperty(java.lang.String name)Retrieves anintproperty value by name.java.lang.StringgetProperty(java.lang.String name)Retrieves a string property value by name.javax.naming.ReferencegetReference()TransactionParameterBuffergetTransactionParameters(int isolation)Get the transaction parameter buffer corresponding to the current connection request information.booleanisWrapperFor(java.lang.Class<?> iface)voidsetBlobBufferLength(java.lang.Integer length)Deprecated.UseAbstractConnectionPropertiesDataSource.setBlobBufferSize(int); will be removed in Jaybird 6voidsetBooleanProperty(java.lang.String name, java.lang.Boolean value)Sets abooleanproperty by name.voidsetDescription(java.lang.String description)Set description of this datasource.voidsetIntProperty(java.lang.String name, java.lang.Integer value)Sets anintproperty by name.voidsetNonStandardProperty(java.lang.String propertyMapping)Set the property that does not have corresponding setter method.voidsetProperty(java.lang.String name, java.lang.String value)Sets a property by name.voidsetTransactionParameters(int isolation, TransactionParameterBuffer tpb)Set transaction parameters for the specified transaction isolation level.<T> Tunwrap(java.lang.Class<T> iface)- 
Methods inherited from class org.firebirdsql.ds.AbstractConnectionPropertiesDataSourcegetAuthPlugins, getBlobBufferSize, getBuffersNumber, getCharSet, getConnectTimeout, getDatabase, getDatabaseName, getDataTypeBind, getDbCryptConfig, getDecfloatRound, getDecfloatTraps, getDefaultIsolation, getDefaultTransactionIsolation, getEncoding, getGeneratedKeysEnabled, getLoginTimeout, getMaxBlobCacheSize, getMaxInlineBlobSize, 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, setMaxBlobCacheSize, setMaxInlineBlobSize, setPageCacheSize, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setScrollableCursor, setServerBatchBufferSize, setServerName, setSessionTimeZone, setSocketBufferSize, setSoTimeout, setSqlDialect, setTimestampUsesLocalTimezone, setTpbMapping, setType, setUseFirebirdAutocommit, setUser, setUserName, setUseServerBatch, setUseStreamBlobs, setWireCompression, setWireCrypt
 - 
Methods inherited from class org.firebirdsql.ds.RootCommonDataSourcegetLogWriter, getParentLogger, setLogWriter
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.BasePropertiesgetBooleanProperty, getIntProperty, getProperty
 - 
Methods inherited from interface javax.sql.CommonDataSourcecreateShardingKeyBuilder, getParentLogger
 - 
Methods inherited from interface javax.sql.DataSourcecreateConnectionBuilder, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 - 
Methods inherited from interface org.firebirdsql.jdbc.FirebirdConnectionPropertiesgetNonStandardProperty, setNonStandardProperty
 
- 
 
- 
- 
- 
Field Detail- 
mcfprotected final FBManagedConnectionFactory mcf 
 - 
dsprotected transient FBDataSource ds 
 - 
descriptionprotected java.lang.String description 
 
- 
 - 
Constructor Detail- 
FBSimpleDataSourcepublic FBSimpleDataSource() Creates an instance using the default GDS type (PURE_JAVA).
 - 
FBSimpleDataSourcepublic FBSimpleDataSource(GDSType type) Creates an instance using the specified GDS type.- Parameters:
- type- GDS type
 
 
- 
 - 
Method Detail- 
getBlobBufferLength@Deprecated public java.lang.Integer getBlobBufferLength() Deprecated.UseAbstractConnectionPropertiesDataSource.getBlobBufferSize(); will be removed in Jaybird 6Get buffer length for the BLOB fields.- Returns:
- length of BLOB buffer.
 
 - 
setBlobBufferLength@Deprecated public void setBlobBufferLength(java.lang.Integer length) Deprecated.UseAbstractConnectionPropertiesDataSource.setBlobBufferSize(int); will be removed in Jaybird 6Set BLOB buffer length. This value influences the performance when working with BLOB fields.- Parameters:
- length- new length of the BLOB buffer.
 
 - 
getTransactionParameterspublic TransactionParameterBuffer getTransactionParameters(int isolation) Description copied from interface:FirebirdConnectionPropertiesGet the transaction parameter buffer corresponding to the current connection request information.- Specified by:
- getTransactionParametersin interface- FirebirdConnectionProperties
- Parameters:
- isolation- transaction isolation level for which TPB should be returned.
- Returns:
- instance of TransactionParameterBuffer.
 
 - 
setTransactionParameterspublic void setTransactionParameters(int isolation, TransactionParameterBuffer tpb)Description copied from interface:FirebirdConnectionPropertiesSet transaction parameters for the specified transaction isolation level. The specified TPB is used as a default mapping for the specified isolation level.- Specified by:
- setTransactionParametersin interface- FirebirdConnectionProperties
- Parameters:
- isolation- transaction isolation level.
- tpb- instance of- TransactionParameterBuffercontaining transaction parameters.
 
 - 
setNonStandardPropertypublic void setNonStandardProperty(java.lang.String propertyMapping) Description copied from interface:FirebirdConnectionPropertiesSet the property that does not have corresponding setter method.- Specified by:
- setNonStandardPropertyin interface- FirebirdConnectionProperties
- Parameters:
- propertyMapping- parameter value in the- propertyName[=propertyValue]form, this allows setting non-standard parameters using configuration files.
 
 - 
getPropertypublic java.lang.String getProperty(java.lang.String name) Description copied from interface:BasePropertiesRetrieves a string property value by name.For properties with an explicit default, this method should return the string presentation of that default, not null. Forintorbooleanthe string equivalent is returned.- Specified by:
- getPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Value of the property, or nullwhen not set or not a known property
 
 - 
setPropertypublic void setProperty(java.lang.String name, java.lang.String value)Description copied from interface:BasePropertiesSets a property by name.This method can be used to set all defined properties, but also properties not known by Jaybird. When setting intorbooleanproperties, the appropriate conversions are applied. Usingnullwill reset to the default value. Forbooleanproperties, an empty string is taken to meantrue.- Specified by:
- setPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
getIntPropertypublic java.lang.Integer getIntProperty(java.lang.String name) Description copied from interface:BasePropertiesRetrieves anintproperty 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 intinstead of checking if something is actually anintproperty- Specified by:
- getIntPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Integer with value of the property, or nullwhen not set
 
 - 
setIntPropertypublic void setIntProperty(java.lang.String name, java.lang.Integer value)Description copied from interface:BasePropertiesSets anintproperty by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent. - Specified by:
- setIntPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
getBooleanPropertypublic java.lang.Boolean getBooleanProperty(java.lang.String name) Description copied from interface:BasePropertiesRetrieves abooleanproperty 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 booleaninstead of checking if something is actually anintproperty- Specified by:
- getBooleanPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Integer with value of the property, or nullwhen not set
 
 - 
setBooleanPropertypublic void setBooleanProperty(java.lang.String name, java.lang.Boolean value)Description copied from interface:BasePropertiesSets abooleanproperty by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent. - Specified by:
- setBooleanPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
connectionPropertyValuespublic java.util.Map<ConnectionProperty,java.lang.Object> connectionPropertyValues() Description copied from interface:BasePropertiesAn unmodifiable view on the connection properties held by this BaseProperties implementation.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.- Specified by:
- connectionPropertyValuesin interface- BaseProperties
- Returns:
- An unmodifiable view on the property values held in this properties instance
 
 - 
getReferencepublic javax.naming.Reference getReference() throws javax.naming.NamingException- Specified by:
- getReferencein interface- javax.naming.Referenceable
- Throws:
- javax.naming.NamingException
 
 - 
getConnectionpublic java.sql.Connection getConnection() throws java.sql.SQLExceptionGet JDBC connection with default credentials.- Specified by:
- getConnectionin interface- javax.sql.DataSource
- Returns:
- new JDBC connection.
- Throws:
- java.sql.SQLException- if something went wrong.
 
 - 
getConnectionpublic java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLExceptionGet JDBC connection with the specified credentials.- Specified by:
- getConnectionin interface- javax.sql.DataSource
- Parameters:
- username- username for the connection.
- password- password for the connection.
- Returns:
- new JDBC connection.
- Throws:
- java.sql.SQLException- if something went wrong.
 
 - 
getDescriptionpublic java.lang.String getDescription() Get description of this datasource.- Returns:
- description of this datasource.
 
 - 
setDescriptionpublic void setDescription(java.lang.String description) Set description of this datasource.- Parameters:
- description- description of this datasource.
 
 - 
getDataSourceprotected javax.sql.DataSource getDataSource() throws java.sql.SQLExceptionGet underlying connection factory (in our case instance ofFBDataSourceclass) that will provide JDBC connections.- Returns:
- JDBC connection factory.
- Throws:
- java.sql.SQLException- if something went wrong.
 
 - 
isWrapperForpublic boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException- Specified by:
- isWrapperForin interface- java.sql.Wrapper
- Throws:
- java.sql.SQLException
 
 - 
unwrappublic <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
- unwrapin interface- java.sql.Wrapper
- Throws:
- java.sql.SQLException
 
 
- 
 
-