Tuxedo interconnection with Oracle Database
(Source: http://www.ccw.com.cn)
Foreword
In large computer applications in banks, telecommunications, finance, etc., the use of middleware is increasingly popular, and the middleware has been intended to be three basic software. As the best middleware products, BEA Tuxedo is widely used in many industries in our country. This article describes how to access the Oracle database in Tuxedo. In the two-layer C / S structure, the client directly accesses the database. After using the Tuxedo middleware, a three-layer structure is formed. At this time, the client does not access the database directly, but is changed to the service on the middleware Tuxedo server, and the database is accessed by the Tuxedo server and returns the result to the client. The Tuxedo server can be on the same server with Oracle, or on a different machine, if in different machines, the machine where the Tuxedo's server is located to install an ORACLE client. There are two ways to connect to the Oracle database: 1, which is not directly interconnected by the XA interface. Suitable for only one database throughout the system. 2, through the XA interface interconnect, there is a database or multiple databases for the entire system, it is recommended to use this interconnect configuration method. In large computer applications in banks, telecommunications, finance, etc., the use of middleware is increasingly popular, and the middleware has been intended to be three basic software. As the best middleware products, BEA Tuxedo is widely used in many industries in our country. This article describes how to access the Oracle database in Tuxedo.
In the two-layer C / S structure, the client directly accesses the database. After using the Tuxedo middleware, a three-layer structure is formed. At this time, the client does not access the database directly, but is changed to the service on the middleware Tuxedo server, and the database is accessed by the Tuxedo server and returns the result to the client. The Tuxedo server can be on the same server with Oracle, or on a different machine, if in different machines, the machine where the Tuxedo's server is located to install an ORACLE client.
Tuxedo server has two ways to connect to Oracle database:
1. Do not connect directly to the XA interface. Suitable for only one database throughout the system.
2, through the XA interface interconnect, there is a database or multiple databases for the entire system, it is recommended to use this interconnect configuration method.
systems mannual
Tuxedo version: 7.1 installation directory D: / tuxedo71 Oracle version: 8.1.5 Installation Directory D: / ORA81 Operating System: Win2000
Configuration steps
First, Oracle's configuration
1. Use the internal user (the default password is Oracle) Enter SQLPlus C: /> SQLPlus Internal / Oracle 2. Run the /rdbms/admin/xaview.sql sql> @d: /ora81/rdbms/admin/xaview.sql 3. Authorized SQL> Grant SELECT ON V $ xatrans $ to public with grant option; SQL> GRANT SELECT ON V $ pending_xatrans $ to public with grant option; 4. Connect to SYSTEM users (default passwords is Manager) and authorize SQL> Connect System / Manager SQL> Grant Select Any Table To Public;
Second, Tuxedo's configuration 1. Modify the RM file under the UDataobj directory of the Tuxedo installation path, put the line with oracle_xa: Xaosw: start with # 注 # #, add a line: Oracle_xa; xaosw; d: /ora81/rdbms/xa/oraxa8.lib d: / ora81 /precomp/lib/msvc/orasql8.lib If it is in the UNIX environment, it is: Oracle_xa: xaosw: -l $ {oracle_home} / lib -lclntsh 2. Create a TMS file under Tuxedo users: TMS_ORA8i, Tuxedo via TMS_ORA8i with Oracle Database With XA Protocol Communication Buildtms -od: / Tuxedo71 / Bin / TMS_ORA8i -r Oracle_xa Note: If the Tuxedo server is not on the same server, it may be prompted to find the library file ORAXA8.LIB and ORASQL8.LIB You can copy these two files to the corresponding directory under the client of the current machine Oracle to the server side of the Oracle database. 3. Configure Ubbconfig (1) Add: TLogDevice = "/ Home / Oracle / Temp / Simpdb / Tlog" TlogName = Tlog Tlogsize = 200 (2) Change * The configuration is: (Scott / Tiger is The users and passwords used in this database can be changed as needed) * Groups group1 lmid = Simple GrPNO = 1 openinfo = "Oracle_xa: Oracle_xa ACC = P / Scott / Tiger Sestm = 600 MaxCur = 5 logDir =." TMSNAME = "TMS_ORA8i" TMSCOUNT = 2 the modified configuration file ubb follows, with -Y ubb regenerate tuxconfig IPCKEY 123456 DOMAINID simpapp MASTER simple MAXACCESSERS 100 mAXSERVERS 50 MAXSERVICES 100 MODEL SHM LDBAL N * MACHINES server LMID = simple APPDIR tmloadcf = " D: / test "tuxconfig =" d: / test / tuxconfig "tuxdir =" d: / tux71 "TLogDevice =" D: / TEST / TLOG "TLOGNAME = TLOG TLOGSIZE = 100 * Groups Group1 LMID = Simple GrPNO = 1 openinfo = "Oracle_xa: Oracle_xa ACC = P / Scott / Tiger Sestm = 600 MaxCur = 5 logDir =." TMSNAME = "TMS_ORA8i" TMSCOUNT = 2 * Servers Default: clopt = "- a" TEST SRVGRP = Group1 SRVID = 1 * Services 4. Renname the following files because the following file names have conflicts with the file name of the Oracle belt, so they have to be renamed.
(1) Tuxedo Installation Path Include Directory The following files are renamed SQLCA.H.h.bbb with sqlcode.h.bbb to rename sqlcode.h.bbb (2) rename SqlCode.h.bbb. The following files under the Tuxedo installation path lib directory are renamed libsql.lib.bb 5. Create a TLOG file with TmAdmin, Tuxedo uses a file TLOG to record the log of the database. Submitted and rollback used to coordinate distributed databases. D: /> tmadmin> CRDL -B 500 -ZD: / TEST / TLOG> CRLOG -M SIMPLE> Q III: The server's program: Test.pc function: Take the value of ENAME according to the Empno to the table EMP according to the client. And return it to the client
#include
Fourth, write client programs: testcli.c
Function: Take the service TEST of the Tuxedo server TEST, take the value of the ENAME corresponding to EMPNO = 1000, and display #include
1. Pretocate Test.pc files into test.c files with test.c files D: / test> proc Test.pc incrudE =% Test.c file D: / Test> PROC TEST.PC INCLUDE =% TUXDIR% / include 2. Customize Test.c into executable files, pay attention - R The Oracle_xa in the RM is consistent with the RM file. D: / test> buildserver -o simpserv -f simpserver.c -r oracle_xa -s test
6. Compiling client programs
D: / test> BuildClient -o testcli -f testcli.c
7. Start TUXEDO with TMBOOT -Y
You should see that all Server starts success. At this time, our server Test Test will automatically establish a connection with the Oracle database and keep this connection until the Tuxedo system or Oracle database is turned off. So in our program Test.pc can't see the statement connected to the database because the connection to the database is now automatically managed by Tuxedo. If the TMS_ORA8i boot failed to generate a * .trc file in the current directory, record the cause of the failure, and there will be some error messages in the Tuxedo's ulog file. Error analysis can be referred to these error messages. D: / test> TMBOOT -Y EXEC TMS_ORA8I-A: Process ID = 1072 ... Started. EXEC TMS_ORA8i-A: Process ID = 528 ... Started. Exec Test -a: Process ID = 876 ... started.
Eight, run the client program