欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Sybase ASE的XA Transactions(分布式事务处理)

程序员文章站 2022-03-25 23:07:50
...

ASE支持分布式事务处理,需要一些额外配置。
Using XA resources with Adaptive Server Enterprise
To use XA resources with an Adaptive Server Enterprise 12.0 or later database running on UNIX or Windows, perform these tasks:

(Windows only.) Verify that you have the correct license file, which is located in %SYBASE%\SYSAM-1_0\licenses\license.dat. To run XA transactions, you must have the ASE_DTM license.

Configure the database to use XA transactions. For more information, see Using the Adaptive Server Distributed Transaction Management Features, available on the Sybase Product Manuals Web page.
Create a database to use for XA transactions.

Configure the database tables and stored procedures required for JDBC connection caches, which are available in $JAGUAR/html/classes/sp/sql_server12.sql.
Configure the database tables required for C/C++ connection caches. You can install these tables by running xa_load.sh (UNIX) or xa_load.bat (Windows), which is located in the EAServer html/classes/sp directory.

Create a login, other than sa, for connecting to the database. You cannot use the sa login to connect to an Adaptive Server Enterprise databases for XA transactions.
Modifying the Adaptive Server configuration files
When you configure an XA resource for C/C++ connection caches, you need to modify two configuration files.
On UNIX:
$JAGUAR/interfaces
$JAGUAR/xa_config
On Windows:
%JAGUAR%\ini\sql.ini
%JAGUAR%\ini\xa_config
interfaces and sql.ini
On UNIX, add these lines to the interfaces file:
DbServer
master tcp ether host 5300
query tcp ether host 5300
On Windows, add these lines to the sql.ini file:
[DbServer]
master=NLWNSCK,host,5200
query=NLWNSCK,host,5200

where DbServer is the name of the database server and host is the name of the machine on which the database server runs. DbServer should have the same value that you entered in the Server Name field when you configured the XA resource.

xa_config
For both operating systems, add these lines to the xa_config file:
[xa]
lrm=serverName
server=DbServer
where:
serverName is the name you entered in the Server Name field when you configured the XA resource.
DbServer is the name of the server you entered in either the interfaces file or the sql.ini file.
serverName and DbServer represent the same server and should have the same value.