Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10479450
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:06:05

informix Linux csdk3.5和数据库perl编程Perl、模块DBIDBD安装
 
一、  下载组件
IBM网站注册并下载clientsdk.3.50.UC3DE.LINUX(informix11.5用这个版本的客户端)
以下三个软件到网址:下载
perl-5.10.0.tar.gz ( 安装DBI时需要的)
ExtUtils-AutoInstall-0.63.tar.gz
DBI-1.607.tar.gz
Test-Pod-1.26.tar.gzDBD安装需要的包)
DBD-Informix-2008.0513.tar.gz
传到linux机器
informix数据库客户端linux安装包clientsdk.2.90.UC4R1.LINUX.tar 上传到/homev/software目录下
DBD-Informix-2008.0513.tar.gz  DBI-1.607.tar.gzExtUtils-AutoInstall-0.63.tar传到/home/software
二、  安装步骤
1.          informix数据库的客户端clientsdk.3.50.UC3DE.LINUXroot 用户,11.5数据库版本使用3.5,其它版本安装一定要与数据库的版本配合,可以参考csdkPDF安装文档的相关部分)
2.          perl-5.10.0.tar.gz (root 用户安装DBI时需要较高的版本,原来机器的5.8可以不做删除操作,安装新的5.10版本是将被覆盖)
3.          安装DBI-1.607(root 用户)
4.          安装ExtUtils-AutoInstall-0.63root 用户)
5.          安装Test-PodDBD使用,root用户)
6.          修改相关的网络连接配置文件(分别使用rootinformix用户修改)
7.          安装DBDinformix用户,必须在安装DBD前设置连接文件(因为DBD执行perl Makefile.PL时,要连接数据库如果连接失败就不能做第二步的make)、安装Test-Pod
8.          测试perl连接
三、  安装组件
1.          安装informix linux client 软件
因为它包含在iif.11.50.UC3DE.Linux-RHEL4中,所以在安装iif.11.50.UC3DE.Linux-RHEL4时选择即可
1)         建立informix用户和目录
[root@localhost ~]# useradd informix
[root@localhost ~]# id informix
uid=500(informix) gid=500(informix) groups=500(informix)
[root@localhost ~]# mkdir /opt/informix
[root@localhost ~]# chown -R informix.informix /opt/informix/
[root@localhost ~]# cd /opt/informix/
[root@localhost informix]# ls
[root@localhost informix]# cd ..
[root@localhost opt]# ll
total 4
drwxr-xr-x  2 informix informix 4096 Jan 14 14:15 informix
[root@localhost opt]# cd informix/
[root@localhost informix]# ls
2)         安装informix linux客户端
解压软件到/opt/infromix
[root@localhost informix]$ tar xvf /home/software/clientsdk.3.50.UC3DE.LINUX.tar
[root@localhost informix]$ ll
total 32288
-rw-r--r--  1 informix informix     4243 Oct 21 18:52 csdk.ini
-rwxr-xr-x  1 informix informix 32934963 Oct 21 19:00 csdk.jar
drwxr-xr-x  2 informix informix     4096 Oct 21 19:01 doc
-rwxr-xr-x  1 informix informix    71680 Oct 21 19:00 installclientsdk
[root@localhost informix]# ./installclientsdk
 
          Initializing InstallShield Wizard........
          Launching InstallShield Wizard........
 
-------------------------------------------------------------------------------
Welcome to the InstallShield Wizard for IBM Informix Client-SDK Version 3.50
The InstallShield Wizard will install IBM Informix Client-SDK Version 3.50 on
your computer.
To continue, choose Next.
IBM Informix Client-SDK Version 3.50
IBM Corporation
Press 1 for Next, 3 to Cancel or 4 to Redisplay [1] 回车
-------------------------------------------------------------------------------
     International License Agreement for Non-Warranted Programs
           Part 1 - General Terms
           BY DOWNLOADING, INSTALLING, COPYING, ACCESSING, OR USING THE PROGRAM
     YOU AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU ARE ACCEPTING THESE
      TERMS ON BEHALF OF ANOTHER PERSON OR A COMPANY OR OTHER LEGAL
      ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE FULL AUTHORITY TO
      BIND THAT PERSON, COMPANY, OR LEGAL ENTITY TO THESE TERMS. IF YOU DO
      NOT AGREE TO THESE TERMS,      
- DO NOT DOWNLOAD, INSTALL, COPY, ACCESS, OR USE THE PROGRAM; AND          
- PROMPTLY RETURN THE PROGRAM AND PROOF OF ENTITLEMENT TO THE PARTY
Press Enter to continue viewing the license agreement, or, Enter "1" to accept
the agreement, "2" to decline it or "99" to go back to the previous screen, "3"
 Print.
1
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 回车
-------------------------------------------------------------------------------
IBM Informix Client-SDK Version 3.50 Install Location
Please specify a directory or press Enter to accept the default directory.
Directory Name: [/opt/IBM/informix] /opt/informix(输入安装目录)
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 回车
-------------------------------------------------------------------------------
Choose the setup type that best suits your needs.
[X] 1 - Typical
        The program will be installed with the suggested configuration.
        Recommended for most users.                                                                                
[ ] 2 - Custom
        The program will be installed with the features you choose.
        Recommended for advanced users.
To select an item enter its number, or 0 when you are finished: [0] 2
[ ] 1 - Typical
        The program will be installed with the suggested configuration.
        Recommended for most users.                                                                                 
[X] 2 - Custom
        The program will be installed with the features you choose.
        Recommended for advanced users.
To select an item enter its number, or 0 when you are finished: [0] 回车
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 回车
-------------------------------------------------------------------------------
Select the features for "IBM Informix Client-SDK Version 3.50" you would like
to install:
   IBM Informix Client-SDK Version 3.50
   To select/deselect a feature or to view its children, type its number:
     1.  [x] Client
     2.  [x] Messages
     3.  [x] Global Language Support (GLS)
   Other options:
     0. Continue installing
   Enter command [0] 回车
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 回车
-------------------------------------------------------------------------------
IBM Informix Client-SDK Version 3.50 will be installed in the following
location:
/opt/informix
with the following features:
Client
Messages
Global Language Support (GLS)
for a total size:
 91.9 MB
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] 回车
Installing IBM Informix Client-SDK Version 3.50. Please wait...
|-----------|-----------|-----------|------------|
0%         25%         50%         75%        100%
||||||||||||||||||||||||||||||||||||||||||||||||||
Creating uninstaller...
Performing GSKit installation for Linux ...
Branding Files ...
Installing directory .
Installing directory etc
Installing directory bin
Installing directory lib
Installing directory lib/client
Installing directory lib/client/csm
Installing directory lib/esql
Installing directory lib/dmi
Installing directory lib/c++
Installing directory lib/cli
Installing directory release
Installing directory release/en_us
Installing directory release/en_us/0333
Installing directory incl
Installing directory incl/esql
Installing directory incl/dmi
Installing directory incl/c++
Installing directory incl/cli
Installing directory demo
Installing directory demo/esqlc
Installing directory demo/c++
Installing directory demo/cli
Installing directory doc
Installing directory doc/gls_api
Installing directory doc/gls_api/en_us
Installing directory doc/gls_api/en_us/0333
Installing directory tmp
Installing directory gsk
Installing directory gsk/client
Installing directory gskit
Installing directory gsk
Installing directory gsk/client
IBM Informix Product:       IBM INFORMIX-Client SDK
Installation Directory: /opt/informix
Performing root portion of installation of IBM INFORMIX-Client SDK...
Installation of IBM INFORMIX-Client SDK complete.
Installing directory etc
Installing directory gls
Installing directory gls/cm3
Installing directory gls/cv9
Installing directory gls/dll
Installing directory gls/etc
Installing directory gls/lc11
Installing directory gls/lc11/cs_cz
Installing directory gls/lc11/da_dk
Installing directory gls/lc11/de_at
Installing directory gls/lc11/de_ch
Installing directory gls/lc11/de_de
Installing directory gls/lc11/en_au
Installing directory gls/lc11/en_gb
Installing directory gls/lc11/en_us
Installing directory gls/lc11/es_es
Installing directory gls/lc11/fi_fi
Installing directory gls/lc11/fr_be
Installing directory gls/lc11/fr_ca
Installing directory gls/lc11/fr_ch
Installing directory gls/lc11/fr_fr
Installing directory gls/lc11/is_is
Installing directory gls/lc11/it_it
Installing directory gls/lc11/ja_jp
Installing directory gls/lc11/ko_kr
Installing directory gls/lc11/nl_be
Installing directory gls/lc11/nl_nl
Installing directory gls/lc11/no_no
Installing directory gls/lc11/os
Installing directory gls/lc11/pl_pl
Installing directory gls/lc11/pt_br
Installing directory gls/lc11/pt_pt
Installing directory gls/lc11/ru_ru
Installing directory gls/lc11/sk_sk
Installing directory gls/lc11/sv_se
Installing directory gls/lc11/th_th
Installing directory gls/lc11/zh_cn
Installing directory gls/lc11/zh_tw
IBM Informix Product:       Gls
Installation Directory: /opt/informix
Performing root portion of installation of Gls...
Installation of Gls complete.
Installing directory etc
Installing directory msg
Installing directory msg/en_us
Installing directory msg/en_us/0333
IBM Informix Product:       messages
Installation Directory: /opt/informix
Performing root portion of installation of messages..
Installation of messages complete.
-------------------------------------------------------------------------------
The InstallShield Wizard has successfully installed IBM Informix Client-SDK
Version 3.50. Choose Finish to exit the wizard.
Press 3 to Finish or 4 to Redisplay [3] 回车
[root@localhost informix]#
安装完成
2.          安装perlroot用户)
[root@localhost perl-5.10.0]# perl –v(查看perl版本)
This is perl, v5.8.5 built for i386-linux-thread-multi
Copyright 1987-2004, Larry Wall
[root@localhost software]# cd /home/software/
[root@localhost software]# tar zxvf perl-5.10.0.tar.gz
[root@localhost software]# cd perl-5.10.0
[root@localhost perl-5.10.0]# more INSTALL(查看安装说明)
[root@localhost perl-5.10.0]# sh Configure –de
The above commands will install Perl to /usr/local
[root@localhost perl-5.10.0]# make
 
…………………………..
……………………………..
cp lib/IO/Compress/Gzip.pm ../../lib/IO/Compress/Gzip.pm
make[1]: Leaving directory `/home/software/perl-5.10.0/ext/IO_Compress_Zlib'
        Everything is up to date. Type 'make test' to run test suite.
[root@localhost perl-5.10.0]# make test
……………………
t/x2p/s2p.....................................................ok
All tests successful.
[root@localhost perl-5.10.0]# make install
……………………..
……………………..
   /usr/local/share/man/man1/s2p.1
make[1]: Leaving directory `/home/software/perl-5.10.0'
[root@localhost perl-5.10.0]#
 
[root@localhost perl-5.10.0]# perl -v
This is perl, v5.10.0 built for i686-linux
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at , the Perl Home Page.
 
[root@localhost perl-5.10.0]#
 
3.          安装DBI-1.607(root 用户)
上传到/home/software解压到/opt/Informix目录下
[root@localhost informix]# tar xvzf /home/software/DBI-1.607.tar.gz
1)         [root@localhost informix]# cd DBI-1.607/
2)         [root@localhost DBI-1.607]# perl Makefile.PL
…………………
…………………
t/zvxgp_87gofer_cache.t
Checking if your kit is complete...
Looks good
    I see you're using perl 5.010000 on i686-linux, okay.
    Remember to actually *read* the README file!
    Use  'make' to build the software (dmake or nmake on Windows).
    Then 'make test' to execute self tests.
    Then 'make install' to install the DBI and then delete this working
    directory before unpacking and building any DBD::* drivers.
Writing Makefile for DBI
[root@localhost DBI-1.607]#
3)         [root@localhost DBI-1.607]#make
……………………….
……………………….
Manifying blib/man3/DBI::DBD.3
Manifying blib/man3/Win32::DBIODBC.3
Manifying blib/man3/DBI::PurePerl.3
Manifying blib/man3/DBI::ProfileData.3
[root@localhost DBI-1.607]#
4)         [root@localhost DBI-1.607]#make test
………………………….
………………………….
Available Drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge
dbi:ExampleP:: testing 3 sets of 20 connections:
Connecting... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Disconnecting...
Connecting... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Disconnecting...
Connecting... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Disconnecting...
connect 20 and disconnect them, 3 times: 0.0319s / 60 = 0.0005s
Testing handle creation speed...
44444 NullP sth/s perl 5.010000 i686-linux (gcc 3.4.6 -O2) 0.000023s
test.pl done
5)         make installroot用户执行安装)
……………………………
……………………………..
Installing /usr/local/bin/dbiproxy
Writing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI/.packlist
Appending installation info to /usr/local/lib/perl5/5.10.0/i686-linux/perllocal.pod
[root@localhost DBI-1.607]#
 
4.          安装ExtUtils-AutoInstall-0.63
1)         解压ExtUtils-AutoInstall-0.63.tar.gzinforix安装目录
[root@localhost informix]# tar zxvf /home/software/ExtUtils-AutoInstall-0.63.tar.gz
[root@localhost informix]# cd ExtUtils-AutoInstall-0.63/
[root@localhost ExtUtils-AutoInstall-0.63]# ls
AUTHORS  inc  Makefile.PL  META.yml  SIGNATURE  TODO
Changes  lib  MANIFEST     README    t
[root@localhost ExtUtils-AutoInstall-0.63]# perl Makefile.PL
*** ExtUtils::AutoInstall version 0.63
*** Checking for dependencies...
[Core Features]
- Cwd                 ...loaded. (3.2501)
- Carp                ...loaded. (1.08)
- ExtUtils::Manifest  ...loaded. (1.51_01)
- ExtUtils::MakeMaker ...loaded. (6.42)
[CPANPLUS Support]
- CPANPLUS            ...loaded. (0.84 >= 0.043)
*** ExtUtils::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for ExtUtils::AutoInstall
[root@localhost ExtUtils-AutoInstall-0.63]# make
cp lib/ExtUtils/AutoInstall.pm blib/lib/ExtUtils/AutoInstall.pm
Manifying blib/man3/ExtUtils::AutoInstall.3
[root@localhost ExtUtils-AutoInstall-0.63]# make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/1-basic.t
t/1-basic....ok                                                              
All tests successful.
Files=1, Tests=6,  0 wallclock secs ( 0.18 cusr +  0.17 csys =  0.35 CPU)
[root@localhost ExtUtils-AutoInstall-0.63]# make installroot用户执行安装)
 
5.          安装Test-PodDBD使用,root用户)
 
[root@localhost informix]# tar zxvf /home/software/Test-Pod-1.26.tar.gz
(解压到/opt/informix目录)
[root@localhost informix]# cd Test-Pod-1.26/
[root@localhost Test-Pod-1.26]# ls
Changes  Makefile.PL  MANIFEST  META.yml  Pod.pm  t
[root@localhost Test-Pod-1.26]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Test::Pod
[root@localhost Test-Pod-1.26]# make
cp Pod.pm blib/lib/Test/Pod.pm
Manifying blib/man3/Test::Pod.3
[root@localhost Test-Pod-1.26]# make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load..............ok 1/1# Testing Test::Pod 1.26, Perl 5.010000, /usr/local/bin/perl
t/00-load..............ok                                                   
t/all_pod_files........ok                                                   
t/cut-outside-block....ok                                                   
t/good.................ok                                                   
t/item-ordering........ok                                                    
t/load.................ok                                                   
t/missing-file.........ok                                                   
t/pod..................ok                                                    
t/selftest.............ok                                                   
t/spaced-directives....skipped
        all skipped: Not written yet
t/unknown-directive....ok                                                   
All tests successful, 1 test skipped.
Files=11, Tests=19,  0 wallclock secs ( 0.31 cusr +  0.21 csys =  0.52 CPU)
[root@localhost Test-Pod-1.26]# make install
Installing /usr/local/lib/perl5/site_perl/5.10.0/Test/Pod.pm
Installing /usr/local/share/man/man3/Test::Pod.3
Writing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/Test/Pod/.packlist
Appending installation info to /usr/local/lib/perl5/5.10.0/i686-linux/perllocal.pod
[root@localhost Test-Pod-1.26]#
6.          修改相关的网络连接配置文件
1)         services文件(文件内容开头添加一行)
[root@localhost ~]# vi /etc/services
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
# Updated from RFC 1700, ``Assigned Numbers'' (October 1994).  Not all ports
# are included, only the more common ones.
#
# The latest IANA port assignments can be gotten from
#      
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
# The Dynamic and/or Private Ports are those from 49152 through 65535
#
# Each line describes one service, and is of the form:
#
# service-name  port/protocol  [aliases ...]   [# comment]
sqlexec         5000/tcp                 #informix client service
 
2)         hosts文件(文件末尾)
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
10.8.0.200              InformixDBServer
 
3)         sqlhosts文件(内容中第一行,注释掉第二行)
[informix@localhost DBD-Informix-2008.0513]$ cd /opt/informix/etc/
[informix@localhost etc]$ ls
ASF-cr          cmsm.cfg.sample  GLS-cr        odbcinst.ini          sqlhosts.demo
brand           CPLUS-cr         glsfiles      OSLIB-cr              SQLI-cr
CLI-cr          DMI-cr           installc      setup.odbc
ClientSDK-cr    ESQL-cr          messagefiles  sqlhosts
clientsdkfiles  GENLIB-cr        odbc.ini      sqlhosts.cmsm.sample
[informix@localhost etc]$ vi 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.
#
#**************************************************************************
demo_on onsoctcp        InformixDBServer        sqlexec
#demo_se        seipcpip        se_hostname     sqlexec(注释掉这一行)
 
4)         设置INFORMIXDIR用户变量
[informix@localhost etc]$vi /home/Informix/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
HOSTNAME=InformixDBServer
export HOSTNAME
INFORMIXDIR=/opt/informix
export INFORMIXDIR
INFORMIXSERVER=demo_on
export INFORMIXSERVER
LD_LIBRARY_PATH=/opt/informix/lib
export LD_LIBRARY_PATH
DBD_INFORMIX_USERNAME=informix
export DBD_INFORMIX_USERNAME
DBD_INFORMIX_PASSWORD=informix
export DBD_INFORMIX_PASSWORD
DBD_INFORMIX_DATABASE=stores_demo
export DBD_INFORMIX_DATABASE
DBI_DBNAME=stores_demo
export DBI_DBNAME
PATH=$HOME/bin:$INFORMIXDIR/bin:$PATH
export PATH
unset USERNAME
 
7.          安装DBDinformix用户)
1)         [informix@localhost informix]$ tar zxvf /home/software/DBD-Informix-2008.0513.tar.gz
解压缩到/opt/informix目录下
2)         建立lib库连接。
进入/opt/informix/lib目录,把esql目录的*.so文件链接过来。
[informix@localhost lib]$ ln –sv  esql/*.so (空格).(点)
3)         转到DBD-Informix-2008.0513目录
[informix@localhost informix]$ cd DBD-Informix-2008.0513/
4)         perl Makefile.PL
perl Makefile.PL(转到/opt/informix/DBD-Informix-2008.0513/)
[informix@localhost DBD-Informix-2008.0513]$ perl Makefile.PL
*** ExtUtils::AutoInstall version 0.63
*** Checking for dependencies...
[Core Features]
- DBI         ...loaded. (1.607 >= 1.38)
[High Resolution Timing]
- Time::HiRes ...loaded. (1.9711)
[POD Format Testing]
- Test::Pod   ...loaded. (1.26)
*** ExtUtils::AutoInstall configuration finished.
Configuring IBM Informix Database Driver for Perl DBI Version 2008.0513 (2008-05-13) (aka DBD::Informix)
        You are using DBI version 1.607 and Perl version 5.010000
Remember to actually read the README file!
Perl:     /usr/local/bin/perl v5.010000 i686-linux dl_dlopen.xs
System:   linux localhost.localdomain 2.6.9-55.elsmp #1 smp fri apr 20 17:03:35 edt 2007 i686 i686 i386 gnulinux
Using INFORMIXDIR=/opt/informix and ESQL/C compiler esql
Using IBM Informix CSDK Version 3.50, IBM Informix-ESQL Version 3.50.UC3DE from /opt/informix
Beware: DBD::Informix is not yet aware of all the new IUS data types.
Assert macro will be disabled!
lib/DBD/Informix/Defaults.pm written OK
esqlinfo.h written OK
Testing whether your Informix test environment will work...
ESQLTEST Program Running:
@(#)$Id: esqltest.ec,v 2008.1 2008/05/13 23:13:10 jleffler Exp $
         $INFORMIXDIR is set to '/opt/informix'.
         $INFORMIXSERVER is set to 'demo_on'.
         $DBI_DBNAME set to 'stores_demo'.
         $DBD_INFORMIX_DATABASE set to 'stores_demo'.
         $DBD_INFORMIX_DATABASE2 unset - defaulting to 'stores_demo'.
         $DBD_INFORMIX_USERNAME is set to 'informix'.
         $DBD_INFORMIX_USERNAME2 is unset - defaulting to 'informix'.
         $DBD_INFORMIX_PASSWORD is set.
         $DBD_INFORMIX_PASSWORD2 is unset - defaulting to $DBD_INFORMIX_PASSWORD.
Testing connection to stores_demo
         CONNECT TO 'stores_demo' with user info
Testing concurrent connection to stores_demo
         CONNECT TO 'stores_demo' with user info
Your Informix environment is (probably) OK
Checking if your kit is complete...
Looks good
Using DBI 1.607 (for perl 5.010000 on i686-linux) installed in /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI/
Writing Makefile for DBD::Informix
[informix@localhost DBD-Informix-2008.0513]$
5)         make
[informix@localhost DBD-Informix-2008.0513]$ make
cp lib/DBD/Informix/Summary.pm blib/lib/DBD/Informix/Summary.pm
cp lib/DBD/Informix/TechSupport.pm blib/lib/DBD/Informix/TechSupport.pm
cp lib/DBD/Informix/GetInfo.pm blib/lib/DBD/Informix/GetInfo.pm
cp lib/Bundle/DBD/Informix.pm blib/lib/Bundle/DBD/Informix.pm
cp lib/DBD/Informix/Configure.pm blib/lib/DBD/Informix/Configure.pm
cp Informix.pm blib/lib/DBD/Informix.pm
cp lib/DBD/Informix/TestHarness.pm blib/lib/DBD/Informix/TestHarness.pm
cp lib/DBD/Informix/TypeInfo.pm blib/lib/DBD/Informix/TypeInfo.pm
cp lib/DBD/Informix/Defaults.pm blib/lib/DBD/Informix/Defaults.pm
cp lib/DBD/Informix/Metadata.pm blib/lib/DBD/Informix/Metadata.pm
/usr/local/bin/perl -p -e "s/~DRIVER~/Informix/g" /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI/Driver.xst > Informix.xsi
/usr/local/bin/perl /usr/local/lib/perl5/5.10.0/ExtUtils/xsubpp  -typemap /usr/local/lib/perl5/5.10.0/ExtUtils/typemap Informix.xs > Informix.xsc && mv Informix.xsc Informix.c
cc -c  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2   -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC "-I/usr/local/lib/perl5/5.10.0/i686-linux/CORE"  -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T Informix.c
INFORMIXC="/usr/local/bin/perl esqlcc" ESQLCC="cc" esql -c -shared  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI  -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2    -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC -I/usr/local/lib/perl5/5.10.0/i686-linux/CORE -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T dbdimp.ec
rm -f dbdimp.c
INFORMIXC="/usr/local/bin/perl esqlcc" ESQLCC="cc" esql -c -shared  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI  -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2    -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC -I/usr/local/lib/perl5/5.10.0/i686-linux/CORE -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T dbdattr.ec
rm -f dbdattr.c
cc -c  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2   -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC "-I/usr/local/lib/perl5/5.10.0/i686-linux/CORE"  -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T sqltoken.c
INFORMIXC="/usr/local/bin/perl esqlcc" ESQLCC="cc" esql -c -shared  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI  -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2    -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC -I/usr/local/lib/perl5/5.10.0/i686-linux/CORE -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T sqltype.ec
rm -f sqltype.c
INFORMIXC="/usr/local/bin/perl esqlcc" ESQLCC="cc" esql -c -shared  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI  -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2    -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC -I/usr/local/lib/perl5/5.10.0/i686-linux/CORE -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T ixblob.ec
rm -f ixblob.c
cc -c  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2   -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC "-I/usr/local/lib/perl5/5.10.0/i686-linux/CORE"  -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T odbctype.c
cc -c  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2   -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC "-I/usr/local/lib/perl5/5.10.0/i686-linux/CORE"  -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T kludge.c
cc -c  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2   -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC "-I/usr/local/lib/perl5/5.10.0/i686-linux/CORE"  -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T link.c
INFORMIXC="/usr/local/bin/perl esqlcc" ESQLCC="cc" esql -c -shared  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI  -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2    -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC -I/usr/local/lib/perl5/5.10.0/i686-linux/CORE -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T esqlcver.ec
rm -f esqlcver.c
INFORMIXC="/usr/local/bin/perl esqlcc" ESQLCC="cc" esql -c -shared  -I/opt/informix/incl/esql -I/usr/local/lib/perl5/5.10.0/i686-linux/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI -I/auto/DBI -I/usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBI  -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2    -DVERSION=\"2008.0513\" -DXS_VERSION=\"2008.0513\" -fPIC -I/usr/local/lib/perl5/5.10.0/i686-linux/CORE -DESQLC_VERSION=350 -DNDEBUG -DDO_NOT_USE_STDERR_H -DESQLC_IFX_LOC_T esqlc_v6.ec
rm -f esqlc_v6.c
Running Mkbootstrap for DBD::Informix ()
chmod 644 Informix.bs
rm -f blib/arch/auto/DBD/Informix/Informix.so
INFORMIXC='/usr/local/bin/perl esqlld' ESQLLD='cc -shared -O2 -L/usr/local/lib' esql  -shared -O2 -L/usr/local/lib Informix.o dbdimp.o dbdattr.o sqltoken.o sqltype.o ixblob.o odbctype.o kludge.o link.o esqlcver.o esqlc_v6.o  -o blib/arch/auto/DBD/Informix/Informix.so      \
              \ 
chmod 755 blib/arch/auto/DBD/Informix/Informix.so
cp Informix.bs blib/arch/auto/DBD/Informix/Informix.bs
chmod 644 blib/arch/auto/DBD/Informix/Informix.bs
cp InformixTechSupport blib/script/InformixTechSupport
/usr/local/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/InformixTechSupport
Manifying blib/man1/InformixTechSupport.1
Manifying blib/man3/DBD::Informix::TechSupport.3
Manifying blib/man3/DBD::Informix::Summary.3
Manifying blib/man3/DBD::Informix::Configure.3
Manifying blib/man3/DBD::Informix::TypeInfo.3
Manifying blib/man3/DBD::Informix::TestHarness.3
Manifying blib/man3/DBD::Informix::GetInfo.3
Manifying blib/man3/Bundle::DBD::Informix.3
Manifying blib/man3/DBD::Informix.3
Manifying blib/man3/DBD::Informix::Defaults.3
Manifying blib/man3/DBD::Informix::Metadata.3
[informix@localhost DBD-Informix-2008.0513]$
6)         make install(使用root用户安装)
[informix@localhost DBD-Informix-2008.0513]$ su -c "make install"
Password: (输入root用户密码)
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBD/Informix/Informix.so
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBD/Informix/Informix.bs
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/TestHarness.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/GetInfo.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/Defaults.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/TypeInfo.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/Metadata.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/Configure.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/Summary.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/DBD/Informix/TechSupport.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/Bundle/DBD/Informix.pm
Installing /usr/local/share/man/man1/InformixTechSupport.1
Installing /usr/local/share/man/man3/Bundle::DBD::Informix.3
Installing /usr/local/share/man/man3/DBD::Informix::Summary.3
Installing /usr/local/share/man/man3/DBD::Informix::Defaults.3
Installing /usr/local/share/man/man3/DBD::Informix.3
Installing /usr/local/share/man/man3/DBD::Informix::Configure.3
Installing /usr/local/share/man/man3/DBD::Informix::TypeInfo.3
Installing /usr/local/share/man/man3/DBD::Informix::Metadata.3
Installing /usr/local/share/man/man3/DBD::Informix::TestHarness.3
Installing /usr/local/share/man/man3/DBD::Informix::GetInfo.3
Installing /usr/local/share/man/man3/DBD::Informix::TechSupport.3
Installing /usr/local/bin/InformixTechSupport
Writing /usr/local/lib/perl5/site_perl/5.10.0/i686-linux/auto/DBD/Informix/.packlist
Appending installation info to /usr/local/lib/perl5/5.10.0/i686-linux/perllocal.pod
[informix@localhost DBD-Informix-2008.0513]$
 
8.          测试perl连接
 
测试脚本一
1       上传测试脚本testinf.pl/opt/Informix目录
2       执行 perl testinf.pl,如果正确安装的话,就能返回结果。
testinf.pl脚本内容:
use DBI;
printf("sysmaster Sample DBD::Informix Program running.\n");
#printf("Variant 5: using fetchrow_array() into variable list\n");
my($dbh) = DBI->connect("DBI:Informix:stores_demo","informix","informix") or die;
my($sth) = $dbh->prepare(q%
        SELECT sname FROM state%) or die;
$sth->execute() or die;
my($fname);
while (($fname) = $sth->fetchrow_array())
{
  printf("%s \n", $fname);
}
undef $sth;
$dbh->disconnect();
printf("\nsysmaster Sample Program over.\n\n");
运行结果如下:
[informix@localhost informix]$ perl testinf.pl
sysmaster Sample DBD::Informix Program running.
Alaska         
Hawaii         
California     
Oregon         
Washington     
Idaho          
Nevada         
Montana        
Wyoming        
Utah           
Arizona        
New Mexico     
Colorado       
North Dakota   
South Dakota   
Nebraska       
Kansas         
Oklahoma       
Texas          
Minnesota      
Iowa           
Missouri       
Arkansas       
Louisiana      
Wisconsin      
Illinois       
Mississippi    
Alabama        
Florida        
Georgia        
South Carolina 
North Carolina 
Tennessee      
Kentucky       
Virginia       
West Virginia  
Maryland       
Indiana        
Michigan       
Ohio           
Pennsylvania   
Delaware       
New Jersey     
New York       
Connecticut    
Vermont        
Rhode Island   
Massachusetts  
New Hampshire  
Maine          
D.C.           
Puerto Rico    
sysmaster Sample Program over.
[informix@localhost informix]$
 
 
 
注释:
1.          红色部分为新加入的连接使用的用户名和密码
2.          该脚本功能: 使用informix用户连接informix数据库服务器的stores_demo实例数据        库选择其中state表的sname列字段内容并打印到屏幕上。
 
 
测试脚本二
 
1)         上传测试脚本testquery.pl/opt/Informix目录
2)         执行 perl testquery.pl,如果正确安装的话,就能返回结果。
 
testquery.pl脚本文件内容
#!/usr/bin/perl -w
use DBI;
open(DEBUG1, ">>/tmp/testquery.txt");
my $row;
my $dbh = DBI->connect("dbi:Informix:stores_demo","informix","informix")
    or die "Can't connect to Informix";
my $prep = "select call_code, code_descr from call_type";
my $sth = $dbh->prepare($prep);
$sth->execute( );
while  ($row = $sth->fetchrow_hashref()) {
   print DEBUG1 "Row : $row->{call_code}\t$row->{code_descr}\n";
}
$dbh->disconnect;
close(DEBUG1);
注释:
1.          关于connect的参数说明,数据库服务器中必须有相应的informix数据库,存在stores实例库,informix用户,用户的密码informix
dbi:使用DBI组件连接
informix:informix数据库类型
stores_demo:连接的数据库名称
informix:连接使用的用户名
informix:连接使用的用户密码
2.          测试结果说明
把附件的testquery.pl 程序上传到安装了 dbidbdinformix client机器上,在安装目录/opt/informix目录使用informix用户执行  perl testquery.pl如果在/tmp/目录下生成testquery.txt文件,其中有在服务器端执行“select call_code, code_descr from call_type 语句的查询结果,表示csdk3.5 DBI DBD安装成功。
 

阅读(2225) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~