用ontape -s ?L 0 ?U databasename;可把一个其他方式创建的数据库改为unbuffered log方式的.
145053.rs6000!TMS_INFORMIX.20204: 020602: TUXEDO Version 6.5 AIX 2 4 007025954C00.
145054.rs6000!TMS_INFORMIX.20204: LIBTUX_CAT:466: ERROR: tpopen TPERMERR xa_open returned XAER_RMERR
145054.rs6000!TMS_INFORMIX.20204: LIBTUX_CAT:300: ERROR: _tlog_open: _gp_tblopen
145054.rs6000!TMS_INFORMIX.20204: LIBTUX_CAT:300: ERROR: _tlog_open: _gp_tblopen: UNIX sys call error - 2
145054.rs6000!tmboot.19178: 020602: TUXEDO Version 6.5 AIX 2 4 007025954C00.
145054.rs6000!tmboot.19178: CMDTUX_CAT:825: ERROR: Process TMS_INFORMIX at simple failed with /T tperrno (TPERMERR - resource manager error)
二、TUXEDO的配置
1. /usr/tuxedo/simpdb/setenv的内容:
. usr/tuxedo/tux.env
INFORMIXDIR=/tmp_mnt/informix/hc; export INFORMIXDIR
INFORMIXSERVER=dhc; export INFORMIXSERVER
PATH=$TUXDIR/bin:$INFORMIXDIR/bin:/bin:/usr/bin:/usr/ccs/bin:.; export PATH
SHLIB_PATH=$SHLIB_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib
/cli:$INFORMIXDIR/lib/c++
:$INFORMIXDIR/lib/client:$INFORMIXDIR/lib/dmi:/usr/lib:/usr/lib/Motif1.2
INCLUDE=$INFORMIXDIR/incl/esql:$INFORMIXDIR/incl:/tuxedo/include:/usr/include; export INCLUDE
CFLAGS="-I$INFORMIXDIR/incl -I$INFORMIXDIR/incl/esql" export CFLAGS
2.重命名下列文件,因为下列文件名与INFORMIX中的文件名有冲突,所以要改名。
1.TUXEDO安装路径include目录下的下面文件
把sqlca.h 改名为 sqlca.h.bbb
把sqlcode.h 改名为 sqlcode.h.bbb
把sqlda.h 改名为 sqlda.h.bbb
2.重命名TUXEDO安装路径lib目录下的下面文件
把libsql.lib 改名为 libsql.lib.bbb
3. 修改TUXEDO安装路径的udataobj目录下的RM文件,加入:
INFORMIX-DSHC:infx_xa_switch:-L/tuxedo/lib -L${INFORMIXDIR}/lib -L${INFORMIXDIR}/lib/esql -lifxa -lifsql -lifasf -lifgen -lifos -lifgls -lnsl -lm -lsec ${INFORMIXDIR}/lib/esql/checkapi.o -lifglx
4. 在TUXEDO用户下创建TMS文件:TMS_INFORMIX,TUXEDO通过TMS_INFORMIX与INFORMIX数据库采用XA协议进行通讯
buildtms -r INFORMIX-DSHC -o /tuxedo/bin/TMS_INFORMIX
5. 配置 UBBCONFIG
1. 在*MACHINES节中增加:
TLOGDEVICE = "/usr/tuxedo/simpdb/TLOG"
TLOGNAME=TLOG
TLOGSIZE=200
2. 改*GROUPS节的配置为:
*GROUPS
GROUP1 LMID=simple GRPNO=1
TMSNAME="TMS_INFORMIX" TMSCOUNT=2
OPENINFO="INFORMIX-DSHC:mydb"
修改后的配置文件ubb内容如下,用tmloadcf -y ubb重新生成tuxconfig
IPCKEY 123456
DOMAINID simpapp
MASTER simple
MAXACCESSERS 100
MAXSERVERS 50
MAXSERVICES 100
MODEL SHM
LDBAL N
*MACHINES
server LMID=simple
APPDIR="/usr/tuxedo/simpdb"
TUXCONFIG="/usr/tuxedo/simpdb/tuxconfig"
TUXDIR="/usr/tuxedo"
TLOGDEVICE = "/usr/tuxedo/simpdb/TLOG"
TLOGNAME=TLOG
TLOGSIZE=100
*GROUPS
GROUP1 LMID=simple GRPNO=1
TMSNAME="TMS_INFORMIX" TMSCOUNT=2
OPENINFO="INFORMIX-DSHC:mydb"
*SERVERS
DEFAULT:
CLOPT="-A"
test SRVGRP=GROUP1 SRVID=1
*SERVICES
6.用TMADMIN创建TLOG文件,TUXEDO用一个文件TLOG记录对数据库操作的日志。用于协调分布式数据库的提交与回滚.
D:\>tmadmin
>crdl -b 500 -z /usr/tuxedo/simpdb/TLOG
>crlog -m simple
>q
三、服务端的程序:test.cp
功能:根据客户端传的EMPNO到表EMP中取ENAME的值,并把它返回给客户端
#include <atmi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sybhesql.h>
#include <sybtesql.h>
EXEC SQL INCLUDE sqlca;
EXEC SQL BEGIN DECLARE SECTION;
long al_empno=0;
char ac_ename[11]="";
EXEC SQL END DECLARE SECTION;
TEST(TPSVCINFO *rqst)
{
/*接收客户端来的数据*/
al_empno = (FBFR32 *)rqst->data;
EXEC SQL select ename into :ac_ename from EMP where empno=:al_empno;
if(sqlca.sqlcode!=0)
{
userlog("select from EMP failure,sqlca.sqlcode=%ld\n",sqlca.sqlcode);
tpreturn( TPFAIL, 0, rqst->data, 0, 0 );
}
/*把取出的结果返回给客户端*/
strcpy(rqst->data,ac_ename);
tpreturn( TPSUCCESS, 0, rqst->data, 0, 0 );
}
四、编写客户端程序: testcli.c
功能:调用TUXEDO服务端的服务TEST,取EMPNO=1000所对应的ENAME的值,并显示出来
#include <stdio.h>
#include "atmi.h"
main(argc, argv)
{
long reqlen=1024;
char *reqbuf;
/* 与TUXEDO服务端建立连接 */
if (tpinit((TPINIT *) NULL) == -1)
{
(void) fprintf(stderr, "Tpinit failed\n");
exit(1);
}
/* 分配发送缓冲区*/
reqbuf = (char *)tpalloc("STRING",NULL,reqlen);
if ( reqbuf == (char *)NULL)
{
printf("tpalloc failed\n");
tpterm();
}
strcpy(reqbuf,"1000");
/*调用TUXEDO的服务TEST*/
if (tpcall("TEST", (char *)reqbuf, 0L, (char **)&reqbuf, (long *)&reqlen, 0< 0 )
{
printf("tpcall failed,tperrno=%ld,tperrtext=%s\n",tperrno,tpstrerror(tperrno));
tpfree(reqbuf);
tpterm();
exit(1);
}
printf("name=%s\n",reqbuf);
tpfree(reqbuf);
tpterm();
return(0);
}
五、编译服务端程序
1.用INFORMIX的esql把test.pc 文件预编译成test.c文件
/usr/tuxedo/simpdb/esql -c test.pc -I$INFORMIXDIR/incl/esql
2.用buildserver把test.c编译成可执行文件,注意-r 后带的INFORMIX-DSHC与RM文件中的一致。
/usr/tuxedo/simpdb/buildserver -o simpserv -f simpserver.c -r INFORMIX-DSHC -s TEST
六、编译客户端程序
/usr/tuxedo/simpdb/buildclient -o testcli -f testcli.c
七、用 tmboot ?y 启动TUXEDO,应能看到所有的SERVER都启动成功.这时,我们的服务端程序test 会自动与INFORMIX数据库建立连接,并一直保持这个连接,直到TUXEDO系统或INFORMIX数据库关闭.所以在我们的程序test.cp中看不到与数据库连接的语句,因为现在与数据库的连接由TUXEDO自动管理.
/usr/tuxedo/simpdb/ tmboot -y
exec TMS_INFORMIX -A :
process id=1072 ... Started.
exec TMS_INFORMIX -A :
process id=528 ... Started.
exec test -A :
process id=876 ... Started.
八、运行客户端程序,应能看到服务端返回的结果
/usr/tuxedo/simpdb/ testcli
name=bill
到此,整个配置过程就大功告成了.INFORMIX的其他版本的配置及在其他操作系统上的配置基本与本文所述差不多,差别主要在RM文件中所连的库文件可能会不样.使用esql -libs 命令得到应用所需的数据库动态连接库.再加上INFORMIX支持XA的库libinfxxa.a,注意在INFORMIX9.13之后,libinfxxa.a 的名字变了,不支持多线程的为libifxa.a,支持多线程的为libthxa.a。
如在环境为:AIX 4.3.3, Tuxedo7.1, Informix Dynamic Server 9.21, Esql/C 9.51 中RM为:
INFORMIX-ONLINE:infx_xa_switch:${INFORMIXDIR}/lib/esql/libifxa.a -L${INFORMIXDIR}/lib -L${INFORMIXDIR}/lib/esql -lifsql -lifasf -lifgen -lifos -lifgls -lnetstub -lc_r -ldl -ltli_r -lm_r ${INFORMIXDIR}/lib/esql/checkapi.o -lifglx
在环境为:AIX 4.3.3, Tuxedo6.5, Informix7.3中RM为:
INFORMIX-OnLine:infx_xa_switch:${INFORMIXDIR}/lib/esql/libinfxxa.a -L${INFORMIXDIR}/lib -L${INFORMIXDIR}/lib/esql -lixsqlshr -lixasfshr -lixgenshr -lixosshr -lixglsshr ${INFORMIXDIR}/lib/esql/checkapi.o -lixglx
如果TMS_INFORMIX启动不成功,查看ULOG文件,根据ULOG文件的信息进行排错.
关于AIX操作系统下系统接口程序移植问题的报告
[开发环境]
操作系统AIX4.3.3、中间件TUXEDO6.5、数据库INFORMIX ESQL 7.24.UC8、开发语言ESQL/C
[环境变量]
#INFORMIX
export INFORMIXDIR=/usr/users/informix
export INFORMIXSERVER=online100
export ONCONFIG=onconfig.100
export TERM=vt100
export TERMCAP=$INFORMIXDIR/etc/termcap
export DB_LOCALE=en_US.8859-1@qmlu
export CLIENT_LOCALE=en_US.8859-1@qmlu
export PATH=$PATH:$INFORMIXDIR/bin:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$HOME/tools/bin:.
#TUXEDO
export TUXDIR=/usr/users/tuxedo
export PATH=$PATH:$TUXDIR/bin:$PATH
COBCPY=:$TUXDIR/cobinclude; export COBCPY
BOPT="-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C OSEXT=cbl"; export COBOPT
PATH=$PATH:$INFORMIXDIR/bin:/usr/ibmcxx/bin
export PATH
export LIBPATH=$TUXDIR/lib:$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:/lib:/usr/lib:
$INFORMIXDIR/incl/esql:$LIBPATH
OSTYPE=AIX;export OSTYPE
[编译文件]
#城综网与业务系统接口的makefile文件
LIBDEP = $(HOME)/lib/SubTrx.a $(HOME)/lib/libmiddleware.a $(HOME)/lib/libsbsapi.a
LINKLIB =-L/usr/users/informix/lib/esql -L/usr/users/informix/lib -lc -lm -ll
OBJ = cs_trans.o pub.o
BINPATH=$(HOME)/bin
CFLAGS= -EDmCltSys -c
CCOPT= -qchars=signed -qcpluscmt -DHIGHFIRST -bstatic
all: $(BINPATH)/cs_trans
$(BINPATH)/cs_trans: $(OBJ)
buildclient -w -o $(HOME)/bin/cs_trans -f "$(OBJ) $(LIBDEP) $(LINKLIB)"
rm -f cs_trans.o
rm -f pub.o
cs_trans.o: cs_trans.ec
esql -I$(HOME)/inc -I$(TUXDIR)/include $(CFLAGS) $(CCOPT) cs_trans.ec
rm -f cs_trans.c
pub.o: pub.ec
[标准输出]
esql -I/usr/DATAS/zqywsrc/inc -I/usr/users/tuxedo/include -EDmCltSys -c -qchars=signed -qcpluscmt -DHIGHFIRST -bstatic cs_trans.ec
rm -f cs_trans.c
esql -I/usr/DATAS/zqywsrc/inc/ -EDmCltSys -c -qchars=signed ?qcpluscmt -DHIGHFIRST -bstatic pub.ec
rm -f pub.c
buildclient -w -o /usr/DATAS/zqywsrc/bin/cs_trans -f "cs_trans.o pub.o
/usr/DATAS/zqywsrc/lib/SubTrx.a /usr/DATAS/zqywsrc/lib/libmiddleware.a /usr/DATAS/zqywsrc/lib/libsbsapi.a -L/usr/users/informix/lib/esql -L/usr/users/informix/lib -lc -lm -ll"
[错误输出]
"cs_trans.ec", line 315.69: 1506-280 (W) Function argument assignment between types "unsigned long*" and "int*" is not allowed.
"pub.ec", line 386.13: 1506-068 (W) Operation between types "signed char*" and "int" is not allowed.
ld: 0711-317 ERROR: Undefined symbol: ._iqdbase
ld: 0711-317 ERROR: Undefined symbol: SQLCODE
ld: 0711-317 ERROR: Undefined symbol: ._iqstmnt
ld: 0711-317 ERROR: Undefined symbol: ._iqdbclose
ld: 0711-317 ERROR: Undefined symbol: ._iqslct
ld: 0711-317 ERROR: Undefined symbol: .sqldetach
ld: 0711-317 ERROR: Undefined symbol: ._iqnprep
ld: 0711-317 ERROR: Undefined symbol: sqlca
ld: 0711-317 ERROR: Undefined symbol: ._iqlocate_cursor
ld: 0711-317 ERROR: Undefined symbol: ._iqdescribe
ld: 0711-317 ERROR: Undefined symbol: .rtypmsize
ld: 0711-317 ERROR: Undefined symbol: .rtypalign
ld: 0711-317 ERROR: Undefined symbol: ._iqcddcl
ld: 0711-317 ERROR: Undefined symbol: ._iqdcopen
ld: 0711-317 ERROR: Undefined symbol: ._iqcftch
ld: 0711-317 ERROR: Undefined symbol: .dectoasc
ld: 0711-317 ERROR: Undefined symbol: .rdatestr
ld: 0711-317 ERROR: Undefined symbol: .stleng
ld: 0711-317 ERROR: Undefined symbol: ._iqclose
ld: 0711-317 ERROR: Undefined symbol: ._iqfree
ld: 0711-317 ERROR: Undefined symbol: ._iqexecute
ld: 0711-317 ERROR: Undefined symbol: .rdefmtdate
ld: 0711-317 ERROR: Undefined symbol: ._iqbeginwork
ld: 0711-317 ERROR: Undefined symbol: ._iqcdcl
ld: 0711-317 ERROR: Undefined symbol: ._iqcommit
ld: 0711-317 ERROR: Undefined symbol: .rfmtdate
ld: 0711-317 ERROR: Undefined symbol: ._iqrollback
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
CMDTUX_CAT:512: ERROR: Cannot execute C compiler cc -I$TUXDIR/include -o /usr/DATAS/zqywsrc/bin/cs_trans -L${TUXDIR}/lib cs_trans.o pub.o /usr/DATAS/zqywsrc/lib/SubTrx.a /usr/DATAS/zqywsrc/lib/libmiddleware.a /usr/DATAS/zqywsrc/lib/libsbsapi.a -L/usr/users/informix/lib/esql -L/usr/users/informix/lib -lc -lm -ll -lwsc -lbuft -lwsc -lnws -lnwi -lnws -lfml -lfml32 -lgp
make: 1254-004 The error code from the last command is 8.