By default, the transaction scope is defined implicitly by the scope of a Server-side call. The transaction starts when the server-side call begins, and is committed when the call ends, unless an unhandled exception occurs mid-call, in which case a rollback will be performed.
The transaction can be controlled explicitly, using Commit and Rollback plugins (in the Database category), following which a new transaction is implicitly started.
A server-side call usually refers to one of the following:
Each server-side call has a main data source. By default the main data-source is jdbc/Main but this setting can be overridden by setting the dataSource property of the model definition the to the name of another data source configured in your application. The main data-source determines, along with the additional settings, what type of transaction is performed.
The following settings effect which kind of transaction will take place:
Shared property of model.
See Main data source definition.
Trigger on database plugin.
If this trigger is specified, and receives a boolean Yes value, the database action will be performed in auto-commit, regardless of any active transaction.
Parameter in context/configuration file.
Specifies which data sources are accessed using an Auto-commit transaction.If the parameter is missing, all data sources except the Main data source will be accessed.If a data source is configured for Distributed transaction, and such a transaction takes place, then it's inclusion in auto_commit_data_sources is ignored.
In context/configuration file.
Specifies whether Distributed transactions can be used, and which data sources can participate in it (See the table below for more details).
Currently Atomikos and JOTM transaction managers can be used. See specific configuration details below.
The following table summarizes all possible configurations, and the transaction types employed on each data source.
Where configuration of data sources 1 through 4 above, is outlined in the following table:
Once a 3rd-party transaction manager is installed and the application is configured (see below), a distributed transaction occurs whenever a server-side call occurs, and the model defining the call (usually one based on the Tersus/Basic/Server plugin) has a dataSource property whose value is one of the data sources configured to implement the transaction manager.
TBC
Download transactions.properties and place it in a directory of your choice, such as tomcat's conf folder (referred to as <Path>).
Add the following JVM properties to your configuration:
-Dcom.atomikos.icatch.file=<Path>/transactions.properties-Dcom.atomikos.icatch.tm_unique_name=<TM_UNIQUE_NAME>
Where <TM_UNIQUE_NAME> is a unique identifier of your choice.
Add the following to your configuration/context file:
<Parameter name="resource_handler_class_name" value="tersus.enterprise.EnterpriseResourceHandler" /><Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction" factory="com.atomikos.icatch.jta.UserTransactionFactory" />
To convert an existing data source to one participating in a distributed transaction, perform the following changes:
<Resource name="<Name>" type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" maxActive="<MaxActive>" maxIdle="<MaxIdle>" maxWait="<MaxWait>" username="<Username>" password="<Password>" url="<URL>" validationQuery="<Query>" />
<Resource name="<Name>" type="com.atomikos.jdbc.AtomikosDataSourceBean" auth="Container" factory="com.atomikos.tomcat.BeanFactory" uniqueResourceName="<UniqueResourceName>" xaDataSourceClassName="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" xaProperties.serverName="<ServerName/IPAddress>" xaProperties.portNumber="<PortNumber>" xaProperties.databaseName="<DatabaseName>" xaProperties.user="<Usename>" xaProperties.password="<Password>" minPoolSize="1" maxPoolSize="30" testQuery="<Query>" />
<Resource name="<Name>" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" maxActive="<MaxActive>" maxIdle="<MaxIdle>" maxWait="<MaxWait>" username="<Username>" password="<Password>" url="<URL>" validationQuery="<Query>" />
<Resource name="<Name>" type="com.atomikos.jdbc.AtomikosDataSourceBean" auth="Container" factory="com.atomikos.tomcat.BeanFactory" uniqueResourceName="<UniqueResourceName>" xaDataSourceClassName="oracle.jdbc.xa.client.OracleXADataSource" xaProperties.URL="<URL>" xaProperties.user="<Usename>" xaProperties.password="<Password>" minPoolSize="1" maxPoolSize="30" testQuery="<Query>" />
Where:
To use the full functionality of this web site, JavaScript needs to be turned on.
For best results, use the Firefox browser..
Copyright © 2003-2017 - Tersus Software Ltd., All rights reserved. Terms of Use License Graphic design by EmaraDesign