由于工作需要,要求在Windows下安装tuxedo,看安装资源非常少,参考前辈出此教程,以方便需要的人学习参考。
一、 选择安装介质
根据操作系统的特性以及本级Microsoft Visual Studio版本,选择匹配的32位或者64位tuexdo安装介质。
64位windows10下可以选择:
tuxedo111120_64_win_2k8_x86_VS2008
tuxedo111120_64_win_2k8_x86_VS2010
本次搭配Oracle11g安装的是tuxedo111120_64_win_2k8_x86_VS2010(注意选择与自己系统位数匹配的安装包)
tuxedo下载地址:
https://www.oracle.com/technetwork/cn/middleware/tuxedo/downloads/index.html
二、 安装java虚拟机配置jdk环境变量
Tuexdo11g 的安装需要java虚拟机支持,所以需要在本机器上安装jdk,选择jdk1.5以上版本,安装后配置 JAVA_HOME,CLASSPATH,PATH
系统环境变量。
例如:
JAVA_HOME= C:\ Program Files \java
CLASSPATH=.;C:\Program Files\Java\jdk1.6.0_21\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_21\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_21\bin
PATH= %JAVA_HOME%\bin
三、 Tuxedo安装
1.选择介质安装
2.进入安装界面点击 [ok]
3.点击[next]
4.首次安装选择Tuexdo安装路径
覆盖安装会选择已经安装的路径
注意在Choose Oracle Home 还是 Choose Product Directory
安装过程中有一个use sample的选项,这里需要勾选,这样你可以使用C语言的样例来跑通第一个simpapp检测安装tuxedo是否成功
6.点击[Next]
7.点击[Next]
8.点击[Next]
9.点击[Install]
10.设置断开和密码
端口按默认:3050
密码:123456
11.监听协议选择[LLE]
12.选择[Next]
13.LDAP 不安装,选择[No]
14.点击[Next]
安装结束。
四、 拷贝simpapp创建工程目录
1.将tuxedo下的simapp代码拷贝
例如:D:\Oracle\tuxedo11gR1\samples\atmi
目录下的simpapp拷贝到D:\src\下。
2.将vcvars32.bat 拷贝到D:/src/simpapp文件下
本机安装的是Microsoft Visual Studio 2010
本机的vcvars32.bat位于D:/Program Files/Microsoft Visual Studio 10.0/VC/bin/vcvars32.bat
五、 创建系统环境变量
1.设置本级的环境变量
APPDIR = D:\src\simpapp
LANG = C
LC_MESSAGES =C
LD_LIBRARY_PATH=D:\Oracle\tuxedo11gR1\bin
NLSPATH=D:\Oracle\tuxedo11gR1\local\C
TUXCONFIG=D:\src\simpapp\tuxconfig(这里先配置环境变量目前还没有生成tuxconfig,后面会生成)
TUXDIR=D:\Oracle\tuxedo11gR1
WSNADDR=192.168.166.111:3050
Path=D:\Oracle\tuxedo11gR1\bin
六、 在D:\src\simpapp找到setenv.cmd
七、 编辑setenv.cmd配置setenv配置文件
rem (c) 2003 BEA Systems, Inc. All Rights Reserved.
rem Copyright (c) 2000 BEA Systems, Inc.
rem All Rights Reserved
rem THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF
rem BEA Systems, Inc.
rem The copyright notice above does not evidence any
rem actual or intended publication of such source code.
rem Copyright (c) 2000 BEA Systems, Inc.
rem All rights reserved
rem ident "@(#) apps/simpapp/setenv.cmd $Revision: 1.5 $"
set LC_MESSAGES=C
set LANG=C
set NLSPATH=D:\Oracle\tuxedo11gR1\locale\C
set TUXDIR=D:\Oracle\tuxedo11gR1
set WSNADDR=192.168.166.111:3050(该tuxedo的地址)
set APPDIR=D:\src\simpapp(程序的目录)
set PATH=%TUXDIR%/bin;%APPDIR%;%PATH%
set TUXCONFIG=%APPDIR%/tuxconfig
Call D:/src/simpapp/vcvars32.bat(加载VS2017环境变量,本机的环境是VS2017,我的机器使用vcvars32.bat不行,我直接把cmd命令行的目录切换到调到vs2017的安装目录,我的目录是C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build 然后输入vcvarsall x86详情请见https://blog.csdn.net/10km/article/details/51722353。(根据你的机器自行决定环境变量的参数)此时输入命令cl出现如下的信息表示加载环境变量成功。)
八、 修改ubbsimple配置文件
# (c) 2003 BEA Systems, Inc. All Rights Reserved.
#ident "@(#) samples/atmi/simpapp/ubbsimple $Revision: 1.7 $"
#Skeleton UBBCONFIG file for the TUXEDO Simple Application.
#Replace the <bracketed> items with the appropriate values.
*RESOURCES
IPCKEY 123456 #<Replace with a valid IPC Key>
#Example:
#IPCKEY 123456
DOMAINID simpapp
MASTER simple
MAXACCESSERS 10
MAXSERVERS 5
MAXSERVICES 10
MODEL SHM
LDBAL N
*MACHINES
DEFAULT:
APPDIR="D:\src\simpapp"
TUXCONFIG="D:\src\simpapp\tuxconfig"
TUXDIR="D:\Oracle\tuxedo11gR1"
#Example:
# APPDIR="/home/me/simpapp"
# TUXCONFIG="/home/me/simpapp/tuxconfig"
# TUXDIR="/usr/tuxedo"
R04419 LMID=simple(#本机机器名,可以在cmd中输入hostname查看本#机的名字,如果名字中有-连接符,例如k1-3,需要用””,形如”k1-3”)
#Example:
#本机机器名称 LMID=simple
*GROUPS
GROUP1
LMID=simple GRPNO=1 OPENINFO=NONE
*SERVERS
DEFAULT:
CLOPT="-A"
simpserv SRVGRP=GROUP1 SRVID=1
*SERVICES
TOUPPER
九、 编译程序
以管理员方式运行cmd,执行下面命令
D:/src/simpapp>dir
驱动器 D 中的卷没有标签。
卷的序列号是 DE8E-46C4
D:/src/simpapp 的目录
2011/05/25 14:19 <DIR> .
2011/05/25 14:19 <DIR> ..
2011/05/25 14:10 2,943 README
2011/05/25 14:10 2,911 README.nt
2011/05/25 14:14 665 setenv.cmd
2011/05/25 14:10 1,953 simpapp.nt
2011/05/25 14:10 1,826 simpcl.c
2011/05/25 14:10 1,632 simpserv.c
2011/05/25 14:18 824 ubbsimple
2009/12/16 05:45 4,062 vcvars32.bat
8 个文件 16,816 字节
2 个目录 92,729,303,040 可用字节
D:/src/simpapp>setenv.cmd //执行环境变量
D:/src/simpapp>rem (c) 2003 BEA Systems, Inc. All Rights Reserved.
D:/src/simpapp>rem Copyright (c) 2000 BEA Systems, Inc.
D:/src/simpapp>rem All Rights Reserved
D:/src/simpapp>rem THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF
D:/src/simpapp>rem BEA Systems, Inc.
D:/src/simpapp>rem The copyright notice above does not evidence any
D:/src/simpapp>rem actual or intended publication of such source code.
D:/src/simpapp>rem Copyright (c) 2000 BEA Systems, Inc.
D:/src/simpapp>rem All rights reserved
D:/src/simpapp>rem ident "@(#) apps/simpapp/setenv.cmd $Revision: 1.5 $
"
D:/src/simpapp>set TUXDIR=D:/bea11g/tuxedo11gR1
D:/src/simpapp>set WSNADDR=192.168.166.111:3050
D:/src/simpapp>set APPDIR=D:/src/simpapp
D:/src/simpapp>set PATH=D:/bea11g/tuxedo11gR1/bin;D:/src/simpapp;d:/oracle/produ
ct/10.2.0/client_1/bin;C:/Program Files/Common Files/Microsoft Shared/Windows Li
ve;C:/Windows/system32;C:/Windows;C:/Windows/System32/Wbem;C:/Windows/System32/W
indowsPowerShell/v1.0/;C:/Program Files/ThinkPad/Bluetooth Software/;C:/Program
Files/ATI Technologies/ATI.ACE/Core-Static;C:/Program Files/Common Files/Lenovo;
C:/Program Files/Common Files/Ulead Systems/MPEG;C:/Program Files/Lenovo/Access
Connections/;C:/Program Files/Windows Live/Shared;C:/Program Files/Lenovo/Client
Security Solution;D:/Program Files/TortoiseSVN/bin;C:/Program Files/Common File
s/Thunder Network/KanKan/Codecs;C:/Program Files/Microsoft SQL Server/100/Tools/
Binn/;C:/Program Files/Microsoft SQL Server/100/DTS/Binn/;d:/Program Files/Windo
ws7Master;D:/bea11g/tuxedo11gR1/bin;D:/bea11g/tuxedo11gR1/jre/bin/server;D:/bea1
1g/tuxedo11gR1/jre/bin;D:/Program Files/IDM Computer Solutions/UltraEdit/
D:/src/simpapp>set TUXCONFIG=D:/src/simpapp/tuxconfig
D:/src/simpapp>Call D:/src/simpapp/vcvars32.bat
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
D:/src/simpapp>buildserver -o simpserv -f simpserv.c -s TOUPPER -v //编译服务器端程序
cl /MD -I"%TUXDIR%"/include -Fesimpserv BS-1a34.c simpserv.c "%TUXDIR%"/lib/li
btux.lib "%TUXDIR%"/lib/libbuft.lib "%TUXDIR%"/lib/libfml.lib "%TUXDIR%"/lib/
libfml32.lib "%TUXDIR%"/lib/libengine.lib wsock32.lib kernel32.lib advapi32.lib
user32.lib gdi32.lib comdlg32.lib winspool.lib -link -implib:BS-1a34.lib
用于 80x86 的 Microsoft (R) 32 位 C/C++ 优化编译器 16.00.30319.01 版
版权所有(C) Microsoft Corporation。保留所有权利。
BS-1a34.c
simpserv.c
正在生成代码...
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:simpserv.exe
-implib:BS-1a34.lib
BS-1a34.obj
simpserv.obj
D:/bea11g/tuxedo11gR1/lib/libtux.lib
D:/bea11g/tuxedo11gR1/lib/libbuft.lib
D:/bea11g/tuxedo11gR1/lib/libfml.lib
D:/bea11g/tuxedo11gR1/lib/libfml32.lib
D:/bea11g/tuxedo11gR1/lib/libengine.lib
wsock32.lib
kernel32.lib
advapi32.lib
user32.lib
gdi32.lib
comdlg32.lib
winspool.lib
D:/src/simpapp>buildclient -o simpcl -f simpcl.c -v //编译客户端程序
cl /MD -I"%TUXDIR%"/include -Fesimpcl simpcl.c "%TUXDIR%"/lib/libtux.lib "%
TUXDIR%"/lib/libbuft.lib "%TUXDIR%"/lib/libfml.lib "%TUXDIR%"/lib/libfml32.lib
"%TUXDIR%"/lib/libengine.lib wsock32.lib kernel32.lib advapi32.lib user32.lib g
di32.lib comdlg32.lib winspool.lib -link -implib:BC-1b6c.lib
用于 80x86 的 Microsoft (R) 32 位 C/C++ 优化编译器 16.00.30319.01 版
版权所有(C) Microsoft Corporation。保留所有权利。
simpcl.c
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:simpcl.exe
-implib:BC-1b6c.lib
simpcl.obj
D:/bea11g/tuxedo11gR1/lib/libtux.lib
D:/bea11g/tuxedo11gR1/lib/libbuft.lib
D:/bea11g/tuxedo11gR1/lib/libfml.lib
D:/bea11g/tuxedo11gR1/lib/libfml32.lib
D:/bea11g/tuxedo11gR1/lib/libengine.lib
wsock32.lib
kernel32.lib
advapi32.lib
user32.lib
gdi32.lib
comdlg32.lib
winspool.lib
十、 提升程序权限
Windows 7 下为编译出来的exe程序提升为执行权限。
如图:
十一、 生成tuxconfig配置文件
D:/src/simpapp>tmloadcf -y ubbsimple //用ubbsimple 生成tuxconfig
d:\>cd src\simpapp
d:\src\simpapp>tmloadcf -y ubbsimple
d:\src\simpapp>
十二、 启动tuexdo服务
D:/src/simpapp>tmboot -y //启动tuxedo
执行过程:
d:\src\simpapp>tmboot –y
Booting all admin and server processes in
D:\src\simpapp\tuxconfig
INFO: Oracle Tuxedo, Version 11.1.1.2.0, 32-bit, Patch Level (none)
Booting admin processes ...
exec BBL -A :
process id=43816 ... Started.
Booting server processes ...
exec simpserv -A :
process id=43372 ... Started.
2 processes started.
d:\src\simpapp>
d:\src\simpapp>tmshutdown -y
Shutting down all admin and server processes in D:\src\simpapp\tuxconfig
Shutting down server processes ...
Server Id = 1 Group Id = GROUP1 Machine = simple: shutdown succeed
ed
Shutting down admin processes ...
Server Id = 0 Group Id = simple Machine = simple: shutdown succeed
ed
2 processes stopped.
十三、 执行tuexdo命令
服务启动后,通过客户端simpcl.exe(程序的作用就是把客服端输入的字符串转换为大写)执行tuexdo命令:
D:/src/simpapp>simpcl.exe weiming
Returned string is: WEIMING
十三 simapp执行流程图
从图上可以看出,总共需要3步。我在这里再细分一下。
流程为
1.配置环境变量
2.编辑ubbconfig文件
3.将ubbconfig文本文件编译为tuxconfig二进制文件
4.编译服务器端程序
5.编译客户端程序
6.启动服务器
7.调用服务