Linux部署ODBC连接informix数据库

1、下载、安装informix-csdk安装包

  • ibm.csdk.4.50.FC4W1.LNX.tar 可以安装在informix的集群上,也可以安装在非informix的机器上

1.1、下载

[root@test ~]# wget https://iwm.dhe.ibm.com/sdfdl/2v2/regs2/mstadm/informix/Xa.2/Xb.YBTN_DlRQlu3TFy95gEcGB8pOJCWo7GBhurOSj1sL-k/Xc.ibm.csdk.4.50.FC4W1.LNX.tar/Xd./Xf.lPr.D1vk/Xg.11016302/Xi.ifxdl/XY.regsrvs/XZ.td5HG7ZumKTZ6q2Dl9Ex3r-TSQMmwc25/ibm.csdk.4.50.FC4W1.LNX.tar

1.2、解压安装

[root@test ~]# mkdir informix
[root@test ~]# tar -xvf ibm.csdk.4.50.FC4W1.LNX.tar -C informix/
[root@test ~]# cd informix
[root@test informix]# ls
csdk.properties doc installclientsdk README_csdk.txt
[root@test informix]# ./installclientsdk
  • 下面这个是安装的过程

[root@test informix]# ./installclientsdk
Preparing to install
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

===============================================================================
Client SDK                                       (created with InstallAnywhere)
-------------------------------------------------------------------------------

Preparing CONSOLE Mode Installation...




===============================================================================
Introduction
------------

This application will guide you through the installation of IBM Informix
Client-SDK 4.50.FC4W1.

Copyright HCL Technologies Ltd. 2017, 2020. All rights reserved.
Copyright IBM Corporation 2001, 2017. All rights reserved.

It is strongly recommended that you quit all programs before continuing with
this installation.

Respond to each prompt to proceed to the next step in the installation. If
you want to change something on a previous step, type 'back'.

You may cancel this installation at any time by typing 'quit'.

PRESS <ENTER> TO CONTINUE:



===============================================================================




  国际程序许可协议

  第一部分 - 通用条款

  下载、安装、复制、访问、单击“接受”按钮,或以其他方式使用程序,即表明
  被许可方同意本协议的条款。如果您代表被许可方接受此类条款,则您陈述并保
  证您拥有完全的授权以使该被许可方接受此类条款的约束。如果您不同意此类条
  款,

  * 则请勿下载、安装、复制、访问、单击“接受”按钮,或使用程序;并且

  * 立即将未使用的介质、文档和权利证明退还至提供方,以便获得您所支付金额
  的退款。如果下载了程序,那么请销毁程序的所有副本。

   1. 定义

  “授权使用” - 被许可方被授权执行或运行程序的指定级别。该级别可按用户
  数、百万个服务单位(MSUs)、处理器价值单元(PVUs)和其他 IBM 指定的使用
  级别进行计量。


按 Enter 键继续查看本许可协议或按 "1" 接受本协议,按 "2" 拒绝本协议,按 "3" 打印本协议,按 "                                                                                                         5" 用英语查看,或按 "99"
  回到上一屏幕。: 1




===============================================================================
Installation Location
---------------------

Where Would You Like to Install IBM Informix Client-SDK 4.50.FC4W1?

Default Install Folder: /opt/informix

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
    :



===============================================================================
Installation Features
---------------------




===============================================================================
Choose ClientSDK Features to Install
------------------------------------

ENTER A COMMA_SEPARATED LIST OF NUMBERS REPRESENTING THE FEATURES YOU WOULD
LIKE TO SELECT, OR DESELECT. TO VIEW A FEATURE'S DESCRIPTION, ENTER
'?<NUMBER>'. PRESS <RETURN> WHEN YOU ARE DONE:

   1- [X] IBM Informix Client-SDK
   2- |-[X] Informix Object Interface for C++
   3-     |-[X] Informix Object Interface for C++ Demos
   4- |-[X] Informix ESQL/C
   5-     |-[X] Informix ESQL/C Demos
   6-     |-[X] 7.2 Application Compatibility Module
   7- |-[X] Informix LIBDMI for Client Applications
   8- |-[X] Informix ODBC Driver
   9-     |-[X] Informix ODBC Driver Demos
  10- |-[X] Informix Common Database Utilities
  11- [X] Global Language Support (GLS)
  12- |-[X] West European and Americas
  13- |-[X] East European and Cyrillic
  14- |-[X] Chinese
  15- |-[X] Japanese
  16- |-[X] Korean
  17- |-[X] Thai

Press <ENTER> to install above selected features or choose the corresponding
number to change the feature selection: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17



===============================================================================
Installation Summary
--------------------

Type 'back' to go to the previous step or 'quit' to cancel the installation.
Please review the following before continuing:

Product Name:
  IBM Informix Client-SDK

Install Folder:
  /opt/informix

Product Features:
  IBM Informix Client-SDK,
  Informix Object Interface for C++,
  Informix ESQL/C,
  Informix LIBDMI for Client Applications,
  Informix ODBC Driver,
  Informix Common Database Utilities,
  Global Language Support (GLS),
  West European and Americas,
  East European and Cyrillic,
  Chinese,
  Japanese,
  Korean,
  Thai

Disk Space Information (for Installation Target):
  Required:     329,740,978 Bytes
  Available: 40,084,959,232 Bytes

PRESS <ENTER> TO CONTINUE:



===============================================================================
Installing...
-------------

[==================|==================|==================|==================]
[------------------|------------------|------------------|-----------------


===============================================================================


Please Wait
-----------

Creating links, branding....
\

===============================================================================


Please Wait
-----------

Creating links, branding....
-

===============================================================================


Please Wait
-----------

Changing owners ...
-

===============================================================================


Please Wait
-----------

Changing directory ownership ...
-

===============================================================================


Please Wait
-----------

Changing owners ...
|

===============================================================================


Please Wait
-----------

Changing owners ...                                                                                                                                                                                  -]



===============================================================================


Please Wait
-----------



===============================================================================
Installation Complete
---------------------

Congratulations. IBM Informix Client-SDK 4.50.FC4W1 has been successfully
installed to:

/opt/informix


PRESS <ENTER> TO EXIT THE INSTALLER:

2、安装unixODBC-devel

[root@test ~]# yum install -y unixODBC-devel unixODBC

2.1、验证安装

[root@test ~]# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /etc/odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

3、配置ODBC驱动

[root@test ~]# vim /etc/odbcinst.ini
# 添加以下模块

[INFORMIX]
Description     = ODBC for IBM Informix
Driver          = /opt/IBM/Informix_Client-SDK/lib/cli/iclit09b.so
Setup           = /opt/IBM/Informix_Client-SDK/lib/cli/iclis09b.so
APILevel=1
ConnectFunctions=YYY
DriverODBCVer=04.10
FileUsage=1
SQLLevel=1
smProcessPerConnect=Y
  • Driver 指定自己文件的安装路径

  • Setup 指定自己文件的安装路径

4、ODBC数据源配置

# 创建并编辑odbc.ini
[root@test ~]# vim /etc/odbc.ini

[sysadmin]
Driver=INFORMIX
Description=INFORMIX
Database=sysadmin
LogonID=informix
pwd=123456
Server=tramsserver
CLIENT_LOCALE=en_us.819
DB_LOCALE=en_us.819
TRANSLATIONDLL=/opt/IBM/Informix_Client-SDK/lib/esql/igo4a304.so

配置参数说明:

  • [sysadmin] :中括号里面需要指定informix数据库名称

  • Driver :对应odbcinst.ini文件中 [ ] 里的名称

  • Database :数据库名称,对应 [ ] 里的名称

  • LogonID:数据库用户名

  • pwd:数据库密码

  • Server:数据库的实例名

  • TRANSLATIONDLL:对应文件的安装路径

5、配置sqlhosts文件

  • 在Informix_Client-SDK的安装目录的etc下编辑sqlhosts文件

[root@test ~]# cd /opt/IBM/Informix_Client-SDK/etc
[root@test ~]# vim sqlhosts
tramsserver onsoctcp 192.168.30.91 8888

sqlhosts文件说明:

  • 可以直接将informix数据库里的sqlhosts文件复制过来

  • 第一列:数据库的实例名

  • 第二列:协议

  • 第三列:informix数据库IP

  • 第四列:informix数据库端口

6、环境变量配置

[root@test ~]# vim ~/.bash_profile
# 添加下面内容

INFORMIXDIR=/opt/IBM/Informix_Client-SDK
INFORMIXSQLHOSTS=/opt/IBM/Informix_Client-SDK/etc/sqlhosts
ODBCINI=/etc/odbc.ini
LD_LIBRARY_PATH=${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/cli:${INFORMIXDIR}/lib/esql
export INFORMIXDIR INFORMIXSQLHOSTS ODBCINI LD_LIBRARY_PATH

[root@test ~]# source ~/.bash_profile

# 登录测试
[root@ansible-test etc]# isql sysadmin
+---------------------------------------+
| Connected!                           |
|                                       |
| sql-statement                         |
| help [tablename]                     |
| quit                                 |
|                                       |
+---------------------------------------+
SQL> quit
上一篇:informix 安装 linux 客户端


下一篇:gbase 连接数据库