Package org.frankframework.jdbc
Class JdbcFacade
java.lang.Object
org.frankframework.jdbc.JdbcFacade
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasPhysicalDestination,IConfigurable,IScopeProvider,IXAEnabled,NameAware,ConfigurableLifecycle,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
- Direct Known Subclasses:
AbstractJdbcMessageBrowser,AbstractJdbcSender,JdbcListener,Locker,SimpleJdbcListener,Tibet2DatabaseStorage
@DestinationType(JDBC)
public class JdbcFacade
extends Object
implements HasPhysicalDestination, IXAEnabled, ConfigurableLifecycle, FrankElement, NameAware
Provides functions for JDBC connections.
N.B. Note on using XA transactions:
If transactions are used, make sure that the database user can access the table SYS.DBA_PENDING_TRANSACTIONS.
If not, transactions present when the server goes down cannot be properly recovered, resulting in exceptions like:
The error code was XAER_RMERR. The exception stack trace follows: javax.transaction.xa.XAException
at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:508)
- Since:
- 4.1
- Author:
- Gerrit van Brakel
-
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConfigure this component.protected ConnectionObtains a connection to the datasource.getConnectionWithTimeout(int timeout) protected DataSourceprotected Stringprotected StringReturns the name and location of the database that this objects operates on.booleanbooleanbooleanindicates implementing object is under transaction control, using XA-transactionsvoidsetAuthAlias(String authAlias) Authentication alias used to authenticate when connecting to databasevoidsetConnectionsArePooled(boolean b) informs the sender that the obtained connection is from a pool (and thus connections are reused and never closed)voidsetDatasourceName(String datasourceName) JNDI name of datasource to be used, can be configured via jmsRealm, toovoidsetDbmsSupportFactory(DbmsSupportFactory dbmsSupportFactory) voidName of the sender or the listenervoidsetPassword(String password) Password for authentication when connecting to database, when none found fromauthAliasvoidsetTransacted(boolean transacted) controls the use of transactionsvoidsetUsername(String username) User name for authentication when connecting to database, when none found fromauthAliasvoidstart()voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.lifecycle.ConfigurableLifecycle
getPhase, isAutoStartup, isConfiguredMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Field Details
-
log
protected org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
JdbcFacade
public JdbcFacade()
-
-
Method Details
-
getLogPrefix
-
configure
Description copied from interface:IConfigurableConfigure this component.configure()is called once at startup of the framework in the configure method of the owner of thisIConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in theconfigure(), to improve performance.In the case of a container, this will propagate the configure signal to all components that apply.
- Specified by:
configurein interfaceIConfigurable- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()- Specified by:
startin interfaceConfigurableLifecycle- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getDatasource
- Throws:
JdbcException
-
setDbmsSupportFactory
-
getDbmsSupport
-
getConnection
Obtains a connection to the datasource.- Throws:
JdbcException
-
getConnectionWithTimeout
- Throws:
JdbcExceptionTimeoutException
-
getPhysicalDestinationName
Returns the name and location of the database that this objects operates on. If no previous connection was made or it cannot determine the destination it returns 'unknown'- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination- See Also:
-
setName
Name of the sender or the listener -
setDatasourceName
JNDI name of datasource to be used, can be configured via jmsRealm, too- Default value
- "jdbc.datasource.default"
-
getDatasourceName
-
setAuthAlias
Authentication alias used to authenticate when connecting to database -
setUsername
User name for authentication when connecting to database, when none found fromauthAlias -
setPassword
Password for authentication when connecting to database, when none found fromauthAlias -
getPassword
-
setTransacted
public void setTransacted(boolean transacted) controls the use of transactions -
isTransacted
public boolean isTransacted()Description copied from interface:IXAEnabledindicates implementing object is under transaction control, using XA-transactions- Specified by:
isTransactedin interfaceIXAEnabled
-
setConnectionsArePooled
public void setConnectionsArePooled(boolean b) informs the sender that the obtained connection is from a pool (and thus connections are reused and never closed)- Default value
- true
-
isConnectionsArePooled
public boolean isConnectionsArePooled()
-