Using Oracle Developer With The Tuxedo TP Monitor
Using Oracle Developer With The Tuxedo TP Monitor
Tuxedo TP Monitor
An Oracle White Paper
January 1999
TABLE OF CONTENTS
1. Introduction ....................................................................................... 1
2. The Interface...................................................................................... 7
3. A Demonstration.............................................................................. 26
4. Appendix .......................................................................................... 36
1. Introduction
This document discusses the use of Oracle’s Developer as a front-end development tool to the
Tuxedo transaction processing (TP) monitor. It provides a brief introduction to client/server
architectures and TP monitors, and describes in detail the programmatic interface between
Oracle Developer and Tuxedo, commonly referred to as D2TX, including an example .
The following table summarizes which releases of Oracle Developer can interface with which
releases of Tuxedo.
Oracle Developer Release Tuxedo Release
Developer/2000 1.3.2 for Windows 3.11 Tuxedo 6.1
Part Numbers: 701-001002-001 (CD)
705-001010-001 (diskette)
Developer/2000 1.3.2 for Windows 95/NT 3.51 Tuxedo 6.1 volume 2
Developer/2000 1.5.x for Windows 95/NT 3.51 Part Number: 701-001004-001 (CD)
Developer/2000 1.6 for Windows 95/NT 3.51
Developer/2000 2.x for Windows 95/NT 3.51
Developer/2000 1.3.3 for Windows 3.11 Tuxedo 6.4
Developer Release 6 for Windows 95/NT 4.0 Part Number: 701-001002-005 (CD)
Developer Release 6 for Solaris 2.5.1
Data S tore
O racle7 Some Business Logic
Select
U pdate R ow s
S QL *Net
Insert R eturn Values
C all S.P.
Oracle7 Data
Store
Select
Update SQL*Net Rows
Insert “XA” interface
Business
Logic
3GL - C, COBOL (!)
User
Interface
Developer/2000
®
1.3 Tuxedo
A TP monitor is an example of a class of software known as middleware, so named because it is
used to manage the interaction between clients and servers, or layers of servers. TP monitors are
a particularly complex and powerful kind of middleware, and provide a framework for many
clients to simultaneously process transactions in a large, distributed system. TP monitors also
provide transaction logging, security and routing capabilities for such systems.
function ATMI.tpinit (
tpinfo in TUXDEF.TPINIT
) return PLS_INTEGER;
int tpnotify ( Not a Tuxedo client function.
CLIENTID *clientid,
char *data,
long len
long flags
);
int tpopen ( Not a Tuxedo client function.
void
);
int tppost ( Planned for a future release.
char *eventname,
char *data,
long len,
long flags
);
char *tprealloc ( function ATMI.tprealloc (
char *ptr, ptr in ORA_FFI.POINTERTYPE,
long size size in PLS_INTEGER
); ) return ORA_FFI.POINTERTYPE;
int tprecv ( function ATMI.tprecv (
int cd, cd in PLS_INTEGER,
char **data, data in out ORA_FFI.POINTERTYPE,
long *len, len in out PLS_INTEGER,
long flags, flags in PLS_INTEGER,
long *revent revent in out PLS_INTEGER
); ) return PLS_INTEGER;
int tpresume ( Planned for a future release.
TPTRANID *tranid,
long flags
);
2.2.1.1 Constants
In short, if the FML field type is short, long, float or double, then use the PL/SQL variable type
NUMBER and the corresponding variant of an overloaded FML function. If the FML field type is
char, string, or carray, then use the PL/SQL variable type VARCHAR2 and the corresponding
variant of an overloaded FML function.
function FML.fadd (
fbfr in ORA_FFI.POINTERTYPE,
fieldid in PLS_INTEGER,
value in NUMBER,
len in PLS_INTEGER
) return PLS_INTEGER;
function FML.fchg (
fbfr in ORA_FFI.POINTERTYPE,
fieldid in PLS_INTEGER,
oc in PLS_INTEGER,
value in NUMBER,
len in PLS_INTEGER
) return PLS_INTEGER;
function FML.ffindocc (
fbfr in ORA_FFI.POINTERTYPE,
fieldid in PLS_INTEGER,
value in NUMBER,
len in PLS_INTEGER
) return PLS_INTEGER;
function FML.fget (
fbfr in ORA_FFI.POINTERTYPE,
fieldid in PLS_INTEGER,
oc in PLS_INTEGER,
value in out NUMBER,
maxlen in out PLS_INTEGER
) return PLS_INTEGER;
function FML.fgetlast (
fbfr in ORA_FFI.POINTERTYPE,
fieldid in PLS_INTEGER,
oc in out PLS_INTEGER,
value in NUMBER,
maxlen in out PLS_INTEGER
) return PLS_INTEGER;
function D2TX.strcpy (
dest in ORA_FFI.POINTERTYPE,
src in out VARCHAR2
) return VARCHAR2;
Application Services
connect_teller, deposit, withdraw...
®
Similarly, the Bank Utilities are presented below in their PL/SQL package specification form.
package BANKUTL is
procedure BEGIN_TRAN;
procedure COMMIT_TRAN;
end;
--
-- If the return length is non-zero, it means that reallocation
-- occurred, and we have to set the buffer and length to the
-- new address and size.
--
if retlen != 0 then
fbfr := fbfr2;
buflen := retlen;
end if;
if ret = -1 then
if atmi.gettperrno = TUXDEF.TPESVCFAIL then
bankdef.errcat := ’SERVICE’;
else
bankdef.errcat := ’TP’;
end if;
bankdef.errtyp := ’TPCALL’;
end if;
return (ret);
end;
There are two issues here. The first is that atmi.tpcall() may reallocate the fielded buffer,
for example, to increase the size of the fielded buffer to be able to contain the data from the
reply. In case this occurs, distinct pointer variables ( fbfr, fbfr1 and fbfr2) are used so as to
preclude any confusion.
The second issue is how to handle an error returned by atmi.tpcall() and not lose the
pointer to the fielded buffer ( fbfr). This pointer is needed so that the calling program can free
the fielded buffer if an error is detected. The solution is apparent from the comment and the
code, nevertheless, it is instructive to see how the error is handled in by the calling routine. The
procedure, OPEN(), in the BANKSVCS PL/SQL package is just such a calling routine and is
reproduced below.
-- Globals useful for all services
--
fbfr ora_ffi.pointertype; -- Fielded Buffer Pointer
buflen pls_integer := 1024; -- Fielded buffer length
ret pls_integer; -- Tuxedo return code
numbuf varchar2(40); -- Buffer for numeric conversions
Note the begin/end block in the middle of the procedure to raise the exception. The exception
handler further below frees the fielded buffer, and aborts the transaction by directly using an
ATMI call, atmi.tpabort().
Although atmi.tpabort() was called directly, it could just as easily have been wrapped by a
bank utility function, similar to bankutl.begin_tran() or bankutl.commit_tran();
not doing so technically violates the layered approach that was recommended earlier.
declare
balance1 number;
balance2 number;
account1 pls_integer := :actions.account1;
account2 pls_integer := :actions.account2;
amount number := :actions.amount;
action varchar2(20) := :bank_svcs.services;
errmsg varchar2(250);
discard number;
item1 varchar2(30) := null;
item2 varchar2(30) := null;
begin
--
-- Call the appropriate service for the current action
-- (We also use this block to display initial balance after
-- creation so if the action is OPEN then we just go back to
-- the main block)
--
if (action = ’OPEN_ACCT’) then
go_block (’bank_svcs’);
return;
elsif (action = ’INQUIRY’) then
banksvcs.inquiry (account1, balance1, errmsg);
:actions.balance1 := balance1;
elsif (action = ’DEPOSIT’) then
banksvcs.deposit (account1, amount, balance1, errmsg);
:actions.balance1 := balance1;
elsif (action = ’WITHDRAW’) then
banksvcs.withdraw (account1, amount, balance1, errmsg);
:actions.balance1 := balance1;
elsif (action = ’CLOSE_ACCT’) then
banksvcs.close (account1, balance1, errmsg);
:actions.balance1 := balance1;
elsif (action = ’TRANSFER’) then
banksvcs.transfer (account1, account2, amount, balance1, balance2, errmsg);
:actions.balance1 := balance1;
:actions.balance2 := balance2;
item1 := ’actions.bal2_label’;
item2 := ’actions.balance2’;
null;
else
errmsg := ’INTERNAL ERROR: Unknown transaction type’;
end if;
In the Object Navigator, move further down to the node called “Canvases”. Expand this node,
and then double-click on any of the canvas icons to see how the three different screens will
appear when the form is running.
Finally, move further down the list to the Program Units node, and expand it to see one PL/SQL
function and four PL/SQL procedures that are associated with this form. Since these routines are
really only specific to this particular form, they are found here rather than in the Oracle
Developer bankapp client PL/SQL library.
This concludes the survey of many of the elements of both the Oracle Developer bankapp client
PL/SQL library and the Oracle Developer bankapp client form. A few tips for developing
Tuxedo clients with Oracle Developer based on the Oracle Developer bankapp client were also
included.
4.2.1 General
• Isn’t there some other interface between Oracle and Tuxedo?
Yes, there is, but it’s a little different than this one. That interface is between an Oracle
database and Tuxedo using the standard XA protocol. The Oracle database fulfills the
role of the data management service on the resource server (third tier), while the Oracle
4.2.2 Marketing
• Are other interfaces available or planned for more recent releases of Tuxedo?
This interface is with Tuxedo System Release 6.4. Interfaces supporting more recent
releases of Tuxedo can be expected if the market demands them. Please feel free to
contact Oracle Developer Product Management if you have a need for such an interface.
• Will there be an interface of FML32 available at some point?
Yes, if there is enough demand from the marketplace to justify the effort.
• What TP monitor interfaces are available or planned for Oracle Developer?
A prototype of a similar interface with Digital Equipment Corporation’s ACMS Desktop
was developed by Oracle Corporation. NCR Corporation has developed an interface to
their TP monitor, TOP END, which is available from NCR. It was recently announced
(20 May 1998) that BEA Systems is in the process of purchasing the TOP END
enterprise middleware technology and product family from NCR, but the agreement is
subject to government approval. NCR Corporation’s URL is “http://www.ncr.com”.
4.3.1.3 Books
• Feuerstein, Steven. ORACLE PL/SQL Programming. Sebastopol, CA: O’Reilly &
Associates, Inc., September 1995. ISBN: 1-56592-142-9. A very rich tome covering just
about everything anyone would want to know about PL/SQL.
4.3.2.3 Books
• Grey, Jim and Reuter, Andreas. Transaction Processing: Concepts and Techniques.
Morgan Kaufmann Publishers, 1993. ISBN 1-55860-190-2. This book is widely
considered to be the authoritative reference book for TP systems.
• Hall, Carl L. Building Client/Server Applications using Tuxedo. John Wiley & Sons,
Inc., 1993. ISBN 0-471-12958-5.
• Primatesta, Fulvio. Tuxedo: An Open Approach to OLTP. Prentice Hall, 1995. ISBN 0-
13-101833-7
Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.
Worldwide Inquiries:
650.506.7000
Fax 650.506.7200
Copyright © Oracle Corporation 1999
All Rights Reserved
Printed in the U.S.A.