現在實際工作中,在不同類型的DB間建立連接非常廣泛,像我們會在ORACLE數據庫中使用INFORMIX數據庫中的資料,也相當於ORACLE內部DBLINK的含義,隻是要從其它類型的數據庫抓取資料,這種’DBLINK’建立起來就有點復雜,下面我們以在ORACLE建立到INFORMIX的LINK為例,列以下簡單步驟:
環境如下:
OS: Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
ORACLE: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
INFORMIX: IBM Informix Dynamic Server Version 9.40.FC7
使用INFORMIX驅動組件: clientsdk.2.90.UC4.LINUX.tar
一、首先,在裝有ORACLE DB的服務器上安裝INFORMIX的驅動程式
[oracle@test infor] $mdir /u/infor
[oracle@test infor] $groupadd –g 200 informix
[oracle@test infor] $useradd –g 200 –G Informix –d /u/infor Informix
[oracle@test infor] $chown –R Informix:Informix /u/infor
釋放clientsdk.2.90.UC4.LINUX.tar,並安裝相應程式:
[oracle@test infor]$ ls
bin csdk.ini doc gls.rpm installclientsdk lib release
clientsdk.2.90.UC4.LINUX.tar csdk.jar etc hua.tar installesql message.rpm RUN_AS_ROOT.clientsdk
clientsdkcontent.rpm demo gls incl install_rpm msg
[oracle@test infor]$ pwd
/u/infor
二、編輯配置文件/etc/odbc.ini
[oracle@test infor]$ cat /etc/odbc.ini
[Infdrv1]
Driver=/u/infor/lib/cli/iclis09b.so
Description=IBM INFORMIX ODBC DRIVER
Database=ds
LogonID=FKPCB
pwd=FKPCB
Servername=on_tcp90
CursorBehavior=0
CLIENT_LOCALE=zh_TW.big5
DB_LOCALE=zh_TW.big5
TRANSLATIONDLL=/u/infor/lib/esql/igo4a304.so
\n
[ODBC]
;uncomment the below line for UNICODE connection
;UNICODE=UCS-4
\n
Trace=0
TraceFile=/tmp/odbctrace.out
InstallDir=/u/infor
[Infuse1]
Driver=/u/infor/lib/cli/iclis09b.so
Description=IBM INFORMIX ODBC DRIVER
Database=ds
LogonID=ODBCMMS
pwd=mms1688
Servername=on_tcp99
CursorBehavior=0
CLIENT_LOCALE=zh_TW.big5
DB_LOCALE=zh_TW.big5
TRANSLATIONDLL=/u/infor/lib/esql/igo4a304.so
\n
[ODBC]
;uncomment the below line for UNICODE connection
;UNICODE=UCS-4
\n
Trace=0
TraceFile=/tmp/odbctrace.out
InstallDir=/u/infor
(當配置多個INFORMIX服務時,也要配置如下文件:
在/etc/services文件尾部加入以下部分即可
# Local services
on_tcp99_srv 9099/tcp)
三、編輯配置文件/u/infor/etc/sqlhosts
[oracle@test etc]$ cat sqlhosts
#********************************************************************
#
# IBM INC.
#
# PROPRIETARY DATA
#
# Licensed Material - Property Of IBM
#
# "Restricted Materials of IBM"
#
# IBM Informix Client SDK
#
# (c) Copyright IBM Corporation 2002. All rights reserved.
#
# Title: sqlhosts.demo
# Description:
# Default sqlhosts file for running demos.
#
#*******************************************************************
cdr129 group - - i=129
on_tcp129 onsoctcp 10.188.131.183 9088 g=cdr129
on_shm129 onipcshm informix on_shm129_srv g=cdr129
cdr90 group - - i=90
on_tcp90 onsoctcp 10.134.98.73 9090 g=cdr90
on_shm90 onipcshm chnhsdb1 on_shm90_srv g=cdr90
cdr69 group - - i=69
on_tcp69 onsoctcp fklntwn on_tcp69_srv g=cdr69
on_shm69 onipcshm fklntwn on_shm69_srv g=cdr69
cdr190 group - - i=190
on_tcp190 onsoctcp test1 on_tcp190_srv g=cdr190
on_shm190 onipcshm test1 on_shm190_srv g=cdr190
cdr99 group - - i=99
on_tcp99 onsoctcp 10.130.14.15 on_tcp99_srv g=cdr99
on_shm99 onipcshm 10.130.14.15 on_shm99_srv g=cdr99
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7836221/viewspace-214884/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7836221/viewspace-214884/