The EDB Blog
June 26, 2015

Back in March, we wrote about the advances EnterpriseDB was working on to make Postgres Plus Advanced Server compatible with XA interface. If you recall, “the purpose of XA compatibility is to support distributed transactions in a heterogeneous environment. As an XA compatible database, Postgres Plus can participate in a distributed transaction as a resource manager. Before we go into the specifics of the XA standard and architecture, it is imperative to define what we mean by a distributed transaction.”

We have been making more progress on this initiative and we’re now are able to run the banking application shipped with Oracle Tuxedo with EDB Postgres Plus as the resource manager. We are able to perform all the operations of the banking application using both the thick and web clients of the banking application. (EnterpriseDB is set to deliver the XA compatibility for its database server Postgres Plus Advanced Server in 2015.)

What follows is a “how-to” for running the Tuxedo banking application with EDB Postgres Plus. This explains all the steps a user needs to perform in order to run the banking application.

Now let’s examine the banking application, known simply as bankapp:

Bankapp is a sample banking application that comes with Oracle Tuxedo. The application performs the following banking functions:

  • Opens and closes accounts.
  • Retrieves account balances.
  • Deposits or withdraws money from an account.
  • Transfers money from one account to another.

Most sub modules of bankapp have been developed in ECPG but some are in C. Bankapp was built to use nearly all of the features of Tuxedo and works with the Oracle database. Now, the research and development team at EDB has successfully ported bankapp to run on EDB Postgres Plus.

Bankapp ERD

Sample Data

The database is populated with sample data containing:

  • 10 branches, which could be part of three different banks
  • 30 tellers  
  • 200 accounts

The values for primary keys of all the tables are chosen carefully as follows:

  • Branch ids from 1 to 10
  • Tellers for branch 1 use ids from 100 onwards
  • Tellers for branch 2 use ids from 200 onwards and so on
  • Accounts for branch 1 use ids from 10000 onwards
  • Accounts for branch 2 use ids from 20000 onwards and so on

Each bank has its own database server. The sample data is divided among the three servers as follows:

Bank Name Branch ID Range Account ID Range
BANKB1 1 to 4 1000 to 49999
BANKB2 5 to 7 50000 to 79999
BANKB3 8 to 10 80000 to 109999

For EDB Postgres Plus to behave as a resource manager for a transaction manager like Tuxedo, we should be able to support a situation where BEGIN TRANSACTION and DMLs will be performed by one process whereas PREPARE TRANSACTION and COMMIT PREPARED could be issued by another process for the same transaction.

We are using pgBouncer to achieve the above functionality.

Connection Management

The bankapp code does not use any connection management features of ECPG. We have to use connection management features because in our connection sharing architecture each client connecting to pgBouncer must identify its group via application_name in connection string.

It was therefore necessary to modify the bankapp code in the following manner.

  • Explicit statements had to be added to establish the connection

EXEC SQL CONNECT TO :con_str AS :app_name USER :user_name;

  • Each “EXEC SQL sql statement ” had to be changed to “EXEC SQL AT :app_name sql statement”.

The connection string, application name and user name are passed to each sub-module using command line arguments in UBBCONFIG file as follows

BAL SRVGRP=BANKB1 SRVID=10 CLOPT="-A -- dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222"

Other changes to bankapp code

AUTOTRAN & LDBAL

Our current implementation does not support auto-transaction mode and load balancing, these two features were therefore turned off in the UBBCONFIG file.

sqlglm

Comment out call to sqlglm which is Oracle specific error handling routine

FOR UPDATE Syntax

Convert "FOR UPDATE OF column_name" statement to "FOR UPDATE".

Setup and Configuration

# Software Version / Mode / Configuration
1 Operating System CentOS 6.6 x86_64
2 PPAS EnterpriseDB 9.5.0.0 on x86_64
3 pgBouncer 1.6rc1
4 java

java version "1.8.0_45"

Java(TM) SE Runtime Environment (build 1.8.0_45-b14) 

5 Tuxedo 12.1.3.0.0, 64-bit, Patch Level (none)
6 Weblogic  
7 bankapp SHM mode
8 User name abbasbutt
9 IP Address 172.16.82.175
10 Tuxedo Home /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0
11 SimpApp Home /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic
12 Weblogic Admin Account weblogic

Setup Java

sudo rpm -ivh jdk-8u45-linux-x64.rpm sudo rpm -ivh jre-8u45-linux-x64.rpm

Steps required to run bankapp with PPAS

sudo update-alternatives --config java

There are 4 programs which provide 'java'. Selection Command ----------------------------------------------- * 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java + 2 /usr/java/jdk1.8.0_45/jre/bin/java 3 /usr/java/jre1.8.0_45/bin/java 4 /usr/lib/jvm/jre-1.5.0-gcj/bin/java

 

Test Java

vim HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("hello"); } } javac HelloWorld.java java HelloWorld hello

 

 

Setup Tuxedo

Download tuxedo121300_64_Linux_01_x86.zip cd /home/abbasbutt/Desktop/tuxedo/Disk1/install/ ./runInstaller

This will launch GUI installer. Make choices according to the following table.

Parameter Value
Name of Installation OraHome1
Path /home/abbasbutt/OraHome_1
Oracle TASM agent Yes
Install Oracle Tuxedo Samples Yes
Configure Oracle Tuxedo tlisten No
Configure LDAP for SSL support No

Test Tuxedo

Go to the appropriate directory cd /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/ Create environment file env.sh TUXDIR=/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0 TUXCONFIG=/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/tuxconfig PATH=$PATH:$TUXDIR/bin LD_LIBRARY_PATH=$TUXDIR/lib export TUXDIR TUXCONFIG PATH LD_LIBRARY_PATH echo $PATH echo $LD_LIBRARY_PATH Setup environment source env.sh Build simple application gcc -I $TUXDIR/include -c simpcl.c buildclient -o simpcl -f "-Xlinker --no-as-needed simpcl.o" buildserver -o simpserv -f simpserv.c -s TOUPPER

Create ubbsimple file *RESOURCES IPCKEY 123456 DOMAINID simpapp MASTER simple MAXACCESSERS 10 MAXSERVERS 5 MAXSERVICES 10 MODEL SHM LDBAL N *MACHINES DEFAULT: APPDIR="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp" TUXCONFIG="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/tuxconfig" TUXDIR="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0" CentOS_6_6_64 LMID=simple *GROUPS GROUP1 LMID=simple GRPNO=1 OPENINFO=NONE *SERVERS DEFAULT: CLOPT="-A" simpserv SRVGRP=GROUP1 SRVID=1 *SERVICES TOUPPER

Load Configuration tmloadcf -y ubbsimple

Boot the application tmboot -y Booting all admin and server processes in /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/tuxconfig INFO: Oracle Tuxedo, Version 12.1.3.0.0, 64-bit, Patch Level (none) Booting admin processes ... exec BBL -A : process id=2834 ... Started. Booting server processes ... exec simpserv -A : process id=2837 ... Started. 2 processes started.

Run the client ./simpcl "hello" Returned string is: HELLO

Shutdown the application tmshutdown -y Shutting down all admin and server processes in /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/tuxconfig Shutting down server processes ... Server Id = 1 Group Id = GROUP1 Machine = simple: shutdown succeeded Shutting down admin processes ... Server Id = 0 Group Id = simple Machine = simple: shutdown succeeded 2 processes stopped.

Test JOLT Modify ubbsimple file *RESOURCES IPCKEY 123456 DOMAINID simpapp MASTER simple MAXACCESSERS 100 MAXSERVERS 25 MAXSERVICES 50 MODEL SHM LDBAL N *MACHINES DEFAULT: APPDIR="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp" TUXCONFIG="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/tuxconfig" TUXDIR="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0" MAXWSCLIENTS=50 CentOS_6_6_64 LMID=simple *GROUPS GROUP1 LMID=simple GRPNO=1 OPENINFO=NONE JSL_GRP LMID=simple GRPNO=2 JSR_GRP LMID=simple GRPNO=3 *SERVERS DEFAULT: CLOPT="-A" simpserv SRVGRP=GROUP1 SRVID=1 JSL SRVGRP=JSL_GRP SRVID=2 CLOPT="-A -- -n //127.0.0.1:12222 -m2 -M4 -x10" JREPSVR SRVGRP=JSR_GRP SRVID=3 CLOPT="-A -- -W -P /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/repository/jrepository" *SERVICES TOUPPER

Create ToUpper.java file import bea.jolt.*; public class ToUpper { public static void main (String[] args) { JoltSession session; JoltSessionAttributes sattr; JoltRemoteService toupper; String outstr; sattr = new JoltSessionAttributes(); sattr.setString(sattr.APPADDRESS, "//127.0.0.1:12222"); sattr.setInt(sattr.IDLETIMEOUT, 300); session = new JoltSession(sattr, null, null,null, null); toupper = new JoltRemoteService ("TOUPPER", session); toupper.setString("STRING", "hello world"); toupper.call(null); outstr = toupper.getStringDef("STRING", null); if (outstr != null) System.out.println(outstr); session.endSession(); System.exit(0); } }

Load Configuration tmloadcf -y ubbsimple

Boot the application tmboot -y Booting all admin and server processes in /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/samples/atmi/simpapp/tuxconfig INFO: Oracle Tuxedo, Version 12.1.3.0.0, 64-bit, Patch Level (none) Booting admin processes ... exec BBL -A : process id=3830 ... Started. Booting server processes ... exec simpserv -A : process id=3833 ... Started. exec JSL -A -- -n //127.0.0.1:12222 -m2 -M4 -x10 : process id=3834 ... Started. exec JREPSVR -A -- -W -P /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/repository/jrepository : process id=3837 ... Started. 4 processes started.

Build & Run the client javac -cp .:/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/classes ToUpper.java java -cp .:/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/* ToUpper HELLO WORLD Setup Weblogic java -jar fmw_12.1.3.0.0_wls.jar

This will launch a GUI installer. Make choices according to the following table.

Parameter Value
Inventory Directory /home/abbasbutt/oraInventory
Operating System Group abbasbutt
Oracle Home /home/abbasbutt/Oracle/Middleware/Oracle_Home
Installation Type Complete with Examples
Administrative Account weblogic
Server Listen Port 7001

Test Weblogic Build & Copy the simpapp files in proper folder structure sudo rm -rf /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic mkdir /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic mkdir /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF mkdir /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/classes mkdir /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/classes/jolt mkdir /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/classes/jolt/simpapp mkdir /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/lib cp /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/jolt.jar /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/lib cp /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/joltjse.jar /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/lib sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/lib/jolt.jar sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/lib/joltjse.jar cd /home/abbasbutt/Desktop/tuxedo/simpapp/tuxedo/src/jolt/simpapp javac -cp .:/home/abbasbutt/Oracle/Middleware/Oracle_Home/oracle_common/modules/*:/home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/lib/* SimpAppServlet.java cp SimpApp.jsp /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/ cp SimpApp.html /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/ cp index.html /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/ cp ../../../WEB-INF/web.xml /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF cp SimpAppServlet.class /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/classes/jolt/simpapp cp simpapp.properties /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/ sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/simpapp.properties sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/SimpApp.jsp sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/SimpApp.html sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/index.html sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/web.xml sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic/WEB-INF/classes/jolt/simpapp/SimpAppServlet.class sudo chmod +r /home/abbasbutt/Desktop/tuxedo/simpapp/weblogic

Deploy the simpapp web application in Weblogic

Start the admin console for Weblogic

8.6.2.2 Click the “Start the Administration Console” button

8.6.2.3 Enter username weblogic & password

8.6.2.4 Click Deployments, give proper path and click Next

8.6.2.5 Choose “Install this deployment as an application” & click next

8.6.2.6 Click Finish

8.6.2.7 Application is now deployed

8.6.2.8 Open this address in the browser “172.16.82.175:7001/weblogic/SimpApp.jsp ”

8.6.2.9 Enter hello in text box and press Post button

8.7 Install PPAS

Go to the site http://www.enterprisedb.com/downloads/postgres-postgresql-downloads.

Click Download button for Linux x86-64 for Current Release.

Provide your email and password to sign in and download ppasmeta-9.4.1.3-linux-x64.tar.gz.

Run the command sudo setenforce Permissive

Run the command sudo ./ppasmeta-9.4.1.3-linux-x64.run

This will launch a GUI installer. Please make choices according to the following table.

Parameter Value
Installation Directory /usr/local/ppas
Select Components Just select Database Server, UN-select the rest
Data Directory /usr/local/ppas/data
WAL Directory /usr/local/ppas/data/pg_xlog
Configuration Mode Oracle Compatible
Password 123
Port 5444
Locale Default Locale
Install Sample Tables and Procedures Yes
Server Utilization General Purpose
Workload Profile OLTP
Autostart pgAgent Service No
Update Notification Service No
Launch Stackbuilder at exit No

8.8 Setup three database servers

8.8.1 Change to database server's bin directory

cd /usr/local/ppas/9.4AS/bin

8.8.2 Initialize three databases servers

./initdb -D ../data1

./initdb -D ../data2

./initdb -D ../data3

8.8.3 Make changes to postgresql.conf file in each data directory

Change the line To
#listen_addresses = 'localhost'  listen_addresses = '*' 
#max_prepared_transactions = 0  max_prepared_transactions = 100 
log_line_prefix = '%t '  log_line_prefix = '[%a] [%t] [%p] [%c] ' 

8.8.4 Add the following lines to pg_hba.conf in each data directory host all all 192.168.2.109/24 trust host all all 192.168.1.109/24 trust host all all 127.0.0.1/32 trust host all all 172.16.82.197/8 trust

8.8.5 Start the three database servers ./edb-postgres -D ../data1 -p 5431 -d 2 ./edb-postgres -D ../data2 -p 5432 -d 2 ./edb-postgres -D ../data3 -p 5433 -d 2

 

8.9 Create bankdb on all the servers ./createdb bankdb -h 127.0.0.1 -p 5431 ./createdb bankdb -h 127.0.0.1 -p 5432 ./createdb bankdb -h 127.0.0.1 -p 5433

8.10 Create tables in bankdb on all the servers

8.10.1 Run edb-psql client for first server ./edb-psql bankdb -h 127.0.0.1 -p 5431

8.10.2 Create the tables

create table BRANCH ( BRANCH_ID integer not null PRIMARY KEY, BALANCE number, LAST_ACCT integer, LAST_TELLER integer, ADDRESS char(60), PHONE char(14) ); create table ACCOUNT ( ACCOUNT_ID integer not null PRIMARY KEY, BRANCH_ID integer not null REFERENCES BRANCH(BRANCH_ID), ACCT_TYPE character, BALANCE number, LAST_NAME char(20), FIRST_NAME char(20), MID_INIT character, ADDRESS char(60), PHONE char(14), SSN char(12) not null ); create table TELLER ( TELLER_ID integer not null PRIMARY KEY, BRANCH_ID integer not null REFERENCES BRANCH(BRANCH_ID), BALANCE number, LAST_NAME char(20), FIRST_NAME char(20), MID_INIT character ); create table HISTORY ( ACCOUNT_ID integer not null, TELLER_ID integer not null REFERENCES TELLER(TELLER_ID), BRANCH_ID integer not null REFERENCES BRANCH(BRANCH_ID), AMOUNT number );

8.10.3 Run edb-psql client for second server ./edb-psql bankdb -h 127.0.0.1 -p 5432 and create the sames tables as for the first server.

8.10.4 Run edb-psql client for third server ./edb-psql bankdb -h 127.0.0.1 -p 5433 and create the sames tables as for the first server.

8.11 Load sample data in all database servers ./edb-psql bankdb -h 127.0.0.1 -p 5431 -f /home/abbasbutt/Desktop/tuxedo/bankapp/gendata_server_1.txt ./edb-psql bankdb -h 127.0.0.1 -p 5432 -f /home/abbasbutt/Desktop/tuxedo/bankapp/gendata_server_2.txt ./edb-psql bankdb -h 127.0.0.1 -p 5433 -f /home/abbasbutt/Desktop/tuxedo/bankapp/gendata_server_3.txt

8.12 Setup pgBouncer To Obtain a modified version of pgBouncer please Contact Sales.

8.13 Modify pgBouncer configuration files cp /home/abbasbutt/Desktop/tuxedo/pgbouncer.ini /usr/local/pgb/bin/ cp /home/abbasbutt/Desktop/tuxedo/userlist.txt /usr/local/pgb/bin/

8.14 Start pgBouncer ./pgbouncer -v pgbouncer.ini

8.15 Test pgBouncer ./edb-psql -h 127.0.0.1 -p 6432 -U abbasbutt -d edb1 edb1=# select * from teller; teller_id | branch_id | balance | last_name | first_name | mid_init -----------+-----------+----------+----------------------+----------------------+---------- 100 | 1 | 99383.00 | Stremler | Clarence | T 200 | 2 | 74746.00 | Steinher | Jane | X 300 | 3 | 71675.00 | Norwood | Larry | Z 400 | 4 | 98677.00 | Yunits | Norman | A (4 rows) edb1=# \q ./edb-psql -h 127.0.0.1 -p 6432 -U abbasbutt -d edb2 edb2=# select * from teller; teller_id | branch_id | balance | last_name | first_name | mid_init -----------+-----------+----------+----------------------+----------------------+---------- 500 | 5 | 74915.00 | Richey | Allan | E 600 | 6 | 81423.00 | Weaver | Keith | O 700 | 7 | 80890.00 | Shiran | Lesley | (3 rows) edb2=# \q ./edb-psql -h 127.0.0.1 -p 6432 -U abbasbutt -d edb3 edb3=# select * from teller; teller_id | branch_id | balance | last_name | first_name | mid_init -----------+-----------+----------+----------------------+----------------------+---------- 800 | 8 | 99093.00 | Kwas | Joseph | 900 | 9 | 88265.00 | Masone | Sharon | 1000 | 10 | 91449.00 | Russell | Doug | S (3 rows) edb1=# \q

8.16 Compile & deploy XA Connector

8.16.1 Install glibc sudo yum install glibc-devel.i686

8.16.2 Change directory to bankapp home cd /home/abbasbutt/Desktop/tuxedo/bankapp

8.16.3 Setup environment source bankvar

8.16.4 Compile XA connector gcc -shared -fPIC -m64 -I /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/include -I /usr/local/ppas/9.4AS/include -L /usr/local/ppas/9.4AS/lib -L /usr/lib64 -lpq -lpthread -o edb_xa_sw pgsw.c

8.16.5 Modify RM file Edit the file /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/RM and add the following lines in it. PPAS_XA_1:pg_xa_sw: -Wl,--no-as-needed /usr/local/ppas/9.4AS/lib/libpq.so /home/abbasbutt/Desktop/tuxedo/bankapp/edb_xa_sw PPAS_XA_2:pg_xa_sw: -Wl,--no-as-needed /usr/local/ppas/9.4AS/lib/libpq.so /home/abbasbutt/Desktop/tuxedo/bankapp/edb_xa_sw PPAS_XA_3:pg_xa_sw: -Wl,--no-as-needed /usr/local/ppas/9.4AS/lib/libpq.so /home/abbasbutt/Desktop/tuxedo/bankapp/edb_xa_sw

8.16.6 Build TMS buildtms -o /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/bin/PPAS_XA_1 -r PPAS_XA_1 buildtms -o /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/bin/PPAS_XA_2 -r PPAS_XA_2 buildtms -o /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/bin/PPAS_XA_3 -r PPAS_XA_3

8.17 Compile bankapp

8.17.1 Change directory to bankapp home cd /home/abbasbutt/Desktop/tuxedo/bankapp

Note : After ECPG it may be required to comment out #include from the generated C file.

ecpg -t util.pc gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c util.c ecpg -t ACCT.pc mkfldhdr -d . bankflds mkfldhdr -d . eventflds gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c ACCT.c buildserver -r PPAS_XA_1 -s OPEN_ACCT -s CLOSE_ACCT -o ACCT -f ACCT.o -f appinit.o -f util.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so ecpg -t BAL.pc viewc -d . aud.v gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c BAL.c buildserver -r PPAS_XA_1 -s ABAL -s TBAL -s ABAL_BID -s TBAL_BID -o BAL -f BAL.o -f appinit.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so ecpg -t BTADD.pc gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c BTADD.c buildserver -r PPAS_XA_1 -s BR_ADD -s TLR_ADD -o BTADD -f BTADD.o -f appinit.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so ecpg -t TLR.pc gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c TLR.c buildserver -r PPAS_XA_1 -s DEPOSIT -s WITHDRAWAL -s INQUIRY -o TLR -f TLR.o -f util.o -f -lm -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c XFER.c buildserver -r PPAS_XA_1 -s TRANSFER -o XFER -f XFER.o -f appinit.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c ACCTMGR.c buildserver -r PPAS_XA_1 -s WATCHDOG -s Q_OPENACCT_LOG -o ACCTMGR -f ACCTMGR.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c AUDITC.c buildserver -r PPAS_XA_1 -s AUDITC -o AUDITC -f AUDITC.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so ecpg -t BALC.pc gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c BALC.c buildserver -r PPAS_XA_1 -s ABALC_BID -s TBALC_BID -o BALC -f BALC.o -f appinit.o -f /usr/local/ppas/9.4AS/lib/libpq.so -f /usr/local/ppas/9.4AS/lib/libecpg.so gcc -I /usr/local/ppas/9.4AS/include -I$TUXDIR/include -c bankmgr.c buildclient -o bankmgr -f "-Xlinker --no-as-needed bankmgr.o" gcc -I /usr/local/ppas/9.4AS/include -I$TUXDIR/include -c audit.c buildclient -o audit -f "-Xlinker --no-as-needed audit.o" gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c auditcon.c buildclient -o auditcon -f "-Xlinker --no-as-needed auditcon.o" gcc -I . -I $TUXDIR/include -I /usr/local/ppas/9.4AS/include/ -c bankclt.c buildclient -o bankclt -f "-Xlinker --no-as-needed bankclt.o"

8.18 Create transaction log device rm /home/abbasbutt/Desktop/tuxedo/bankapp/tux_log.txt tmadmin -c crdl -z /home/abbasbutt/Desktop/tuxedo/bankapp/tux_log.txt -b 2000

8.19 Modify ubbshm file according to setup *RESOURCES IPCKEY 80952 MAXACCESSERS 100 MAXSERVERS 100 MAXSERVICES 100 MAXCONV 10 MASTER MyMachineID MODEL SHM LDBAL N *MACHINES DEFAULT: APPDIR="/home/abbasbutt/Desktop/tuxedo/bankapp" TUXCONFIG="/home/abbasbutt/Desktop/tuxedo/bankapp/tuxconfig" TUXDIR="/home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0" TLOGDEVICE="/home/abbasbutt/Desktop/tuxedo/bankapp/tux_log.txt" TLOGNAME=TUX_LOG MAXWSCLIENTS=50 CentOS_6_6_64 LMID=MyMachineID *GROUPS DEFAULT: TMSCOUNT=2 LMID=MyMachineID BANKB1 GRPNO=1 TMSNAME=PPAS_XA_1 OPENINFO="PPAS_XA_1:dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222" BANKB2 GRPNO=2 TMSNAME=PPAS_XA_2 OPENINFO="PPAS_XA_2:dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=333" BANKB3 GRPNO=3 TMSNAME=PPAS_XA_3 OPENINFO="PPAS_XA_3:dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=444" JSL_GRP GRPNO=5 JSR_GRP GRPNO=6 *SERVERS DEFAULT: CLOPT="-A" TLR SRVGRP=BANKB1 SRVID=1 CLOPT="-A -- teller_id=100 evt_thresh=1000 dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222" TLR SRVGRP=BANKB2 SRVID=2 CLOPT="-A -- teller_id=500 evt_thresh=1000 dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=333" TLR SRVGRP=BANKB3 SRVID=3 CLOPT="-A -- teller_id=800 evt_thresh=1000 dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=444" XFER SRVGRP=BANKB1 SRVID=4 CLOPT="-A -- dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222" XFER SRVGRP=BANKB2 SRVID=5 CLOPT="-A -- dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=333" XFER SRVGRP=BANKB3 SRVID=6 CLOPT="-A -- dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=444" ACCT SRVGRP=BANKB1 SRVID=7 CLOPT="-A -- dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222" ACCT SRVGRP=BANKB2 SRVID=8 CLOPT="-A -- dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=333" ACCT SRVGRP=BANKB3 SRVID=9 CLOPT="-A -- dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=444" BAL SRVGRP=BANKB1 SRVID=10 CLOPT="-A -- dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=555" BAL SRVGRP=BANKB2 SRVID=11 CLOPT="-A -- dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=666" BAL SRVGRP=BANKB3 SRVID=12 CLOPT="-A -- dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=777" BTADD SRVGRP=BANKB1 SRVID=13 CLOPT="-A -- dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222" BTADD SRVGRP=BANKB2 SRVID=14 CLOPT="-A -- dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=333" BTADD SRVGRP=BANKB3 SRVID=15 CLOPT="-A -- dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=444" AUDITC SRVGRP=BANKB1 SRVID=16 CONV=Y MIN=1 MAX=10 RQADDR="auditc" BALC SRVGRP=BANKB1 SRVID=27 CLOPT="-A -- dbname=edb1 user=edb port=6432 host=127.0.0.1 application_name=222" BALC SRVGRP=BANKB2 SRVID=28 CLOPT="-A -- dbname=edb2 user=edb port=6432 host=127.0.0.1 application_name=333" BALC SRVGRP=BANKB3 SRVID=29 CLOPT="-A -- dbname=edb3 user=edb port=6432 host=127.0.0.1 application_name=444" JSL SRVGRP=JSL_GRP SRVID=40 CLOPT="-A -- -n //127.0.0.1:12222 -m2 -M4 -x10" JREPSVR SRVGRP=JSR_GRP SRVID=50 CLOPT="-A -- -W -P /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/repository/jrepository" *SERVICES DEFAULT: LOAD=50 AUTOTRAN=N TRANTIME=30 WITHDRAWAL PRIO=50 ROUTING=ACCOUNT_ID DEPOSIT PRIO=50 ROUTING=ACCOUNT_ID TRANSFER PRIO=50 ROUTING=ACCOUNT_ID INQUIRY PRIO=50 ROUTING=ACCOUNT_ID CLOSE_ACCT PRIO=40 ROUTING=ACCOUNT_ID OPEN_ACCT PRIO=40 ROUTING=BRANCH_ID BR_ADD PRIO=20 ROUTING=BRANCH_ID TLR_ADD PRIO=20 ROUTING=BRANCH_ID ABAL PRIO=30 ROUTING=b_id TBAL PRIO=30 ROUTING=b_id ABAL_BID PRIO=30 ROUTING=b_id TBAL_BID PRIO=30 ROUTING=b_id ABALC_BID PRIO=30 ROUTING=b_id TBALC_BID PRIO=30 ROUTING=b_id *ROUTING ACCOUNT_ID FIELD=ACCOUNT_ID BUFTYPE="FML" RANGES="10000-49999:BANKB1, 50000-79999:BANKB2, 80000-109999:BANKB3" BRANCH_ID FIELD=BRANCH_ID BUFTYPE="FML" RANGES="1-4:BANKB1, 5-7:BANKB2, 8-10:BANKB3" b_id FIELD=b_id BUFTYPE="VIEW:aud" RANGES="1-4:BANKB1, 5-7:BANKB2, 8-10:BANKB3"

8.20 Boot the bankapp rm /home/abbasbutt/Desktop/tuxedo/bankapp/tuxconfig tmshutdown -y tmloadcf -y ubbshm tmboot -y

8.21 Run the bankapp client ./bankclt Welcome to the Tuxedo Bank Make a selection from the following choices 1. Balance Inquiry 2. Withdrawal 3. Deposit 4. Transfer 5. Open Account 6. Close Account 0. Exit Application Enter Selection: 1 Enter Account Number: 10000 ACCOUNT_ID 10000 Account Balance: $1456.00 Welcome to the Tuxedo Bank Make a selection from the following choices 1. Balance Inquiry 2. Withdrawal 3. Deposit 4. Transfer 5. Open Account 6. Close Account 0. Exit Application Enter Selection: 1 Enter Account Number: 20000 ACCOUNT_ID 20000 Account Balance: $1596.00 Welcome to the Tuxedo Bank Make a selection from the following choices 1. Balance Inquiry 2. Withdrawal 3. Deposit 4. Transfer 5. Open Account 6. Close Account 0. Exit Application Enter Selection: 2 Enter Account Number: 30000 Enter Amount: 1 Going to withdraw $1.00 from account 30000 Withdrawal for $1.00 succeeded Account Balance: $882.00 Welcome to the Tuxedo Bank Make a selection from the following choices 1. Balance Inquiry 2. Withdrawal 3. Deposit 4. Transfer 5. Open Account 6. Close Account 0. Exit Application Enter Selection: 3 Enter Account Number: 40000 Enter Amount: 1 Deposit for $1.00 succeeded Account Balance: $692.00 Welcome to the Tuxedo Bank Make a selection from the following choices 1. Balance Inquiry 2. Withdrawal 3. Deposit 4. Transfer 5. Open Account 6. Close Account 0. Exit Application Enter Selection: 4 Enter Source Account Number: 40000 Enter Destination Account Number: 70000 Enter Amount: 1 Transfer for $1.00 succeeded Source Account 40000 Balance: $691.00 Destination Account 70000 Balance: $1932.00 Welcome to the Tuxedo Bank Make a selection from the following choices 1. Balance Inquiry 2. Withdrawal 3. Deposit 4. Transfer 5. Open Account 6. Close Account 0. Exit Application Enter Selection: 0

8.22 Setup bankapp client to run in the browser sudo rm -rf /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic mkdir /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic mkdir /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF mkdir /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/classes mkdir /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/classes/jolt mkdir /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/classes/jolt/bankapp mkdir /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/lib cp /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/jolt.jar /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/lib cp /home/abbasbutt/OraHome_1/tuxedo12.1.3.0.0/udataobj/jolt/joltjse.jar /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/lib sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/lib/jolt.jar sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/lib/joltjse.jar cd /home/abbasbutt/Desktop/tuxedo/bankapp/tuxedo/src/jolt/bankapp javac -cp .:/home/abbasbutt/Oracle/Middleware/Oracle_Home/oracle_common/modules/*:/home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/lib/* DepositServlet.java cp depositForm.html /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/ cp tellerForm.html /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/ cp ../../../WEB-INF/web.xml /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF cp DepositServlet.class /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/classes/jolt/bankapp cp bankapp.properties /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/ sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/bankapp.properties sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/depositForm.html sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/tellerForm.html sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/web.xml sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic/WEB-INF/classes/jolt/bankapp/DepositServlet.class sudo chmod +r /home/abbasbutt/Desktop/tuxedo/bankapp/weblogic

To deploy the bankapp in Weblogic follow the same steps as done in section 8.7.2. Beware to delete the simpapp before deploying bankapp.

8.23 Test bankapp in browser

8.23.1 Open “172.16.82.175:7001/weblogic/tellerForm.html” in the browser

8.23.2 Click the Deposit button

8.23.3 Enter account number, Amount to deposit and click Deposit button

Abbas Butt is an Architect at EnterpriseDB.

Abbas Butt is an Architect at EnterpriseDB, currently focused on working as a core development team member of Postgres-XC.