- All Implemented Interfaces:
Serializable
,AttachmentProperties
,BaseProperties
,DatabaseConnectionProperties
,FirebirdConnectionProperties
FBManagedConnection
, and implements many of the internal
functions of FBManagedConnection. This behavior is required due to firebird requiring all work done in a transaction
to be done over one connection.
To support xa semantics, the correct db handle must be located whenever a managed connection is associated with a xid.
- Author:
- David Jencks, Mark Rotteveel
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new pure-Java FBManagedConnectionFactory.FBManagedConnectionFactory
(boolean shared) Create a new pure-Java FBManagedConnectionFactory.FBManagedConnectionFactory
(boolean shared, GDSType gdsType) Create a new FBManagedConnectionFactory based on the given GDSType.FBManagedConnectionFactory
(boolean shared, GDSType gdsType, FBConnectionProperties connectionProperties) Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.FBManagedConnectionFactory
(GDSType gdsType) Create a new FBManagedConnectionFactory based on the given GDSType.FBManagedConnectionFactory
(GDSType gdsType, FBConnectionProperties connectionProperties) Create a new FBManagedConnectionFactory based on the given GDSType and connection properties. -
Method Summary
Modifier and TypeMethodDescriptionThecanonicalize
method is used in FBDriver to reuse previous fbmcf instances if they have been created.An unmodifiable view on the connection properties held by this BaseProperties implementation.Creates ajavax.sql.DataSource
instance.createConnectionFactory
(XcaConnectionManager connectionManager) Creates ajavax.sql.DataSource
instance.Creates a new physical connection to the Firebird database using the default configuration.createManagedConnection
(FBConnectionRequestInfo connectionRequestInfo) Creates a new physical connection to the Firebird database.boolean
void
forget
(FBManagedConnection mc, Xid xid) getBooleanProperty
(String name) Retrieves aboolean
property value by name.Get the GDS implementation type around which this factory is based.getIntProperty
(String name) Retrieves anint
property value by name.getProperty
(String name) Retrieves a string property value by name.boolean
getTpb
(int isolation) getTransactionParameters
(int isolation) Get the transaction parameter buffer corresponding to the current connection request information.int
hashCode()
void
recover
(FBManagedConnection mc, Xid xid) void
setBooleanProperty
(String name, Boolean value) Sets aboolean
property by name.void
setDefaultConnectionManager
(XcaConnectionManager defaultCm) void
setIntProperty
(String name, Integer value) Sets anint
property by name.void
setNonStandardProperty
(String propertyMapping) Set the property that does not have corresponding setter method.void
setProperty
(String name, String value) Sets a property by name.void
setTransactionParameters
(int isolation, TransactionParameterBuffer tpb) Set transaction parameters for the specified transaction isolation level.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties
getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEnableProtocol, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSocketFactory, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEnableProtocol, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSocketFactory, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties
getBooleanProperty, getIntProperty, getProperty
Methods inherited from interface org.firebirdsql.jaybird.props.DatabaseConnectionProperties
getBlobBufferSize, getDatabaseName, getDataTypeBind, getDecfloatRound, getDecfloatTraps, getDefaultIsolation, getDefaultTransactionIsolation, getGeneratedKeysEnabled, getPageCacheSize, getReportSQLWarnings, getScrollableCursor, getServerBatchBufferSize, getSessionTimeZone, getSqlDialect, getTpbMapping, isAllowTxStmts, isAsyncFetch, isColumnLabelForName, isCreateDatabaseIfNotExist, isDefaultResultSetHoldable, isExtendedMetadata, isIgnoreProcedureType, isUseCatalogAsPackage, isUseFirebirdAutocommit, isUseServerBatch, isUseStreamBlobs, setAllowTxStmts, setAsyncFetch, setBlobBufferSize, setColumnLabelForName, setCreateDatabaseIfNotExist, setDatabaseName, setDataTypeBind, setDecfloatRound, setDecfloatTraps, setDefaultIsolation, setDefaultResultSetHoldable, setDefaultTransactionIsolation, setExtendedMetadata, setGeneratedKeysEnabled, setIgnoreProcedureType, setPageCacheSize, setReportSQLWarnings, setScrollableCursor, setServerBatchBufferSize, setSessionTimeZone, setSqlDialect, setTpbMapping, setUseCatalogAsPackage, setUseFirebirdAutocommit, setUseServerBatch, setUseStreamBlobs
Methods inherited from interface org.firebirdsql.jdbc.FirebirdConnectionProperties
getUserName, setUserName
-
Constructor Details
-
FBManagedConnectionFactory
public FBManagedConnectionFactory()Create a new pure-Java FBManagedConnectionFactory.This managed connection factory can be shared.
-
FBManagedConnectionFactory
public FBManagedConnectionFactory(boolean shared) Create a new pure-Java FBManagedConnectionFactory.- Parameters:
shared
- Indicates that this Managed Connection Factory can be shared or not. Whentrue
configuration changes are not allowed after the first connection or datasource has been created to ensure all shared users have the same expectation of configuration.
-
FBManagedConnectionFactory
Create a new FBManagedConnectionFactory based on the given GDSType.This managed connection factory can be shared.
- Parameters:
gdsType
- The GDS implementation to use
-
FBManagedConnectionFactory
Create a new FBManagedConnectionFactory based on the given GDSType.- Parameters:
shared
- Indicates that this Managed Connection Factory can be shared or not. Whentrue
configuration changes are not allowed after the first connection or datasource has been created to ensure all shared users have the same expectation of configuration.gdsType
- The GDS implementation to use
-
FBManagedConnectionFactory
Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.This managed connection factory can be shared.
- Parameters:
gdsType
- The GDS implementation to useconnectionProperties
- Initial connection properties (will be copied), use ofnull
is allowed
-
FBManagedConnectionFactory
public FBManagedConnectionFactory(boolean shared, GDSType gdsType, FBConnectionProperties connectionProperties) Create a new FBManagedConnectionFactory based on the given GDSType and connection properties.- Parameters:
shared
- Indicates that this Managed Connection Factory can be shared or not. Whentrue
configuration changes are not allowed after the first connection or datasource has been created to ensure all shared users have the same expectation of configuration.gdsType
- The GDS implementation to useconnectionProperties
- Initial connection properties (will be copied), use ofnull
is allowed
-
-
Method Details
-
getDatabaseFactory
-
getGDSType
Get the GDS implementation type around which this factory is based.- Returns:
- The GDS implementation type
-
getTransactionParameters
Description copied from interface:FirebirdConnectionProperties
Get the transaction parameter buffer corresponding to the current connection request information.- Specified by:
getTransactionParameters
in interfaceFirebirdConnectionProperties
- Parameters:
isolation
- transaction isolation level for which TPB should be returned.- Returns:
- instance of
TransactionParameterBuffer
.
-
setNonStandardProperty
Description copied from interface:FirebirdConnectionProperties
Set the property that does not have corresponding setter method.- Specified by:
setNonStandardProperty
in interfaceFirebirdConnectionProperties
- Parameters:
propertyMapping
- parameter value in thepropertyName[=propertyValue]
form, this allows setting non-standard parameters using configuration files.
-
setTransactionParameters
Description copied from interface:FirebirdConnectionProperties
Set transaction parameters for the specified transaction isolation level. The specified TPB is used as a default mapping for the specified isolation level.- Specified by:
setTransactionParameters
in interfaceFirebirdConnectionProperties
- Parameters:
isolation
- transaction isolation level.tpb
- instance ofTransactionParameterBuffer
containing transaction parameters.
-
setDefaultConnectionManager
-
getProperty
Description copied from interface:BaseProperties
Retrieves a string property value by name.For properties with an explicit default, this method should return the string presentation of that default, not
null
. Forint
orboolean
the string equivalent is returned.- Specified by:
getProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Value of the property, or
null
when not set or not a known property
-
setProperty
Description copied from interface:BaseProperties
Sets a property by name.This method can be used to set all defined properties, but also properties not known by Jaybird. When setting
int
orboolean
properties, the appropriate conversions are applied. Usingnull
will reset to the default value. Forboolean
properties, an empty string is taken to meantrue
.- Specified by:
setProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
getIntProperty
Description copied from interface:BaseProperties
Retrieves anint
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 anint
property- Specified by:
getIntProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Integer with value of the property, or
null
when not set
-
setIntProperty
Description copied from interface:BaseProperties
Sets anint
property by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
- Specified by:
setIntProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
getBooleanProperty
Description copied from interface:BaseProperties
Retrieves aboolean
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 aboolean
property- Specified by:
getBooleanProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Integer with value of the property, or
null
when not set
-
setBooleanProperty
Description copied from interface:BaseProperties
Sets aboolean
property by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
- Specified by:
setBooleanProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
connectionPropertyValues
Description copied from interface:BaseProperties
An 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:
connectionPropertyValues
in interfaceBaseProperties
- Returns:
- An unmodifiable view on the property values held in this properties instance
-
hashCode
public int hashCode() -
equals
-
getDefaultConnectionRequestInfo
- Throws:
SQLException
-
getDefaultTpb
- Throws:
SQLException
-
getTpb
- Throws:
SQLException
-
createConnectionFactory
Creates ajavax.sql.DataSource
instance. The data source instance gets initialized with the passed XcaConnectionManager.- Parameters:
connectionManager
- Connection manager- Returns:
- data source instance
-
createConnectionFactory
Creates ajavax.sql.DataSource
instance. The data source instance gets initialized with a default XcaConnectionManager provided by the resource adapter.- Returns:
- data source instance
-
createManagedConnection
Creates a new physical connection to the Firebird database using the default configuration.- Returns:
- Managed connection instance
- Throws:
SQLException
- generic exception- See Also:
-
createManagedConnection
public FBManagedConnection createManagedConnection(FBConnectionRequestInfo connectionRequestInfo) throws SQLException Creates a new physical connection to the Firebird database.ManagedConnectionFactory uses the additional ConnectionRequestInfo to create this new connection.
- Parameters:
connectionRequestInfo
- Additional resource adapter specific connection request information, can benull
for default- Returns:
- Managed connection instance
- Throws:
SQLException
- generic exception- See Also:
-
canonicalize
Thecanonicalize
method is used in FBDriver to reuse previous fbmcf instances if they have been created. It should really be package access level- Returns:
- a
FBManagedConnectionFactory
value
-
forget
-
recover
-
getCacheKey
-