当前位置:   article > 正文

Linux部署ODBC连接informix数据库_linux登录informix数据库

linux登录informix数据库

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
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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 下面这个是安装的过程
[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:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241

2、安装unixODBC-devel

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

debian系统:apt-get install unixodbc unixodbc-dev
  • 1
  • 2
  • 3
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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

配置参数说明:

  • [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
  • 1
  • 2
  • 3

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

​ 标签: 亲测没有问题

​ [好文要顶](javascript:void(0)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/705963
推荐阅读
相关标签