1. 程式人生 > 其它 >Java學習-day09-面向物件三

Java學習-day09-面向物件三

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