perl通过ODBC连接greenplum

网上这方面的资料很少,而且也不新,我这个刚写的,应该是最新的了吧,见正文吧:
需要安装的有3个:
PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64.tar.Z(greenplum的ODBC驱动程序)
DBD-ODBC-1.58.tar.gz				 (perl的ODBC模块)
DBI-1.641.tar.gz				 (perl的API模块),因为之前已经安装,此处不再重复安。

--1、安装连接GP的ODBC驱动
[root@mshanfengGP soft]# tar -xzvf PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64.tar.Z -C ./PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64
autorun.dat
etc/lang/license.txt
etc/lang/msg.dat
etc/lang/useng.msg
etc/lic/makelica
etc/lic/makelich
etc/lic/makelichx
etc/lic/makelicl
etc/lic/makeliclx
etc/lic/makelics
etc/lic/makelicsx
install.mi
linuxx/license.txt
linuxx/NOTICES.TXT
linuxx/ODBC64FIXES.TXT
linuxx/ODBC64README.TXT
linuxx/scr1
linuxx/tarfiles/brand.tar
linuxx/tarfiles/drda.tar
linuxx/tarfiles/greenplum.tar
linuxx/tarfiles/hive.tar
linuxx/tarfiles/impala.tar
linuxx/tarfiles/infcl.tar
linuxx/tarfiles/linuxx.tar
linuxx/tarfiles/mssql.tar
linuxx/tarfiles/mysql.tar
linuxx/tarfiles/oracle.tar
linuxx/tarfiles/oraclewp.tar
linuxx/tarfiles/postgresql.tar
linuxx/tarfiles/progress.tar
linuxx/tarfiles/salesforce.tar
linuxx/tarfiles/sqlserverwp.tar
linuxx/tarfiles/sybaseiq.tar
linuxx/tarfiles/sybase.tar
linuxx/tarfiles/teradata.tar
unixmi.ksh

--安装ksh
[root@mshanfengGP PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64]# yum install ksh
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.njupt.edu.cn

base                                                                                                                                  | 3.7 kB     00:00     
extras                                                                                                                                | 3.4 kB     00:00     

http://mirrors.njupt.edu.cn/centos/6.9/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
尝试其他镜像。
updates                                                                                                                               | 3.4 kB     00:00     
updates/primary_db                                                                                                                    | 8.1 MB     00:01     
解决依赖关系
--> 执行事务检查
---> Package ksh.x86_64 0:20120801-37.el6_9 will be 安装
--> 完成依赖关系计算

依赖关系解决

=============================================================================================================================================================
 软件包                          架构                               版本                                           仓库                                 大小
=============================================================================================================================================================
正在安装:
 ksh                             x86_64                             20120801-37.el6_9                              updates                             761 k

事务概要
=============================================================================================================================================================
Install       1 Package(s)

总下载量:761 k
Installed size: 1.7 M
确定吗?[y/N]:在用户的命令下退出                               --可能是我点错了,有提示,下面可以继续安装
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx-2018-05-19-05-31p8qxlX.yumtx
[root@mshanfengGP PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64]# 
[root@mshanfengGP PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64]# yum load-transaction /tmp/yum_save_tx-2018-05-19-05-31p8qxlX.yumtx
已加载插件:fastestmirror
loading transaction from /tmp/yum_save_tx-2018-05-19-05-31p8qxlX.yumtx
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.njupt.edu.cn
解决依赖关系
--> 执行事务检查
--> 完成依赖关系计算

依赖关系解决

=============================================================================================================================================================
 软件包                          架构                               版本                                           仓库                                 大小
=============================================================================================================================================================
正在安装:
 ksh                             x86_64                             20120801-37.el6_9                              updates                             761 k

事务概要
=============================================================================================================================================================
Install       1 Package(s)

总下载量:761 k
Installed size: 1.7 M
确定吗?[y/N]:y
下载软件包:
http://mirrors.njupt.edu.cn/centos/6.9/updates/x86_64/Packages/ksh-20120801-37.el6_9.x86_64.rpm: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
尝试其他镜像。
ksh-20120801-37.el6_9.x86_64.rpm                                                                                                      | 761 kB     00:00     
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
  正在安装   : ksh-20120801-37.el6_9.x86_64                                                                                                              1/1 
  Verifying  : ksh-20120801-37.el6_9.x86_64                                                                                                              1/1 

已安装:
  ksh.x86_64 0:20120801-37.el6_9                                                                                                                             

完毕!

--安装GP的ODBC驱动
[root@mshanfengGP PROGRESS_DATADIRECT_ODBC_GREENPLUM_LINUX_64]# ksh unixmi.ksh
In the Key field, enter either EVAL or the Key provided.

Name          :  mengshanfeng
Company       :  mengxianglove
Serial Number :  1076681984
Key           :  1076681984

Enter YES to accept the above agreement : yes
To change this information, enter C. Otherwise, press Enter to continue. : 
Enter the full path to the temporary install directory.[/tmp]: 
Enter the full path to the install directory.[/opt/Progress/DataDirect/Connect64_for_ODBC_71]: 
Would you like to install another product (Y/N) ? [Y]n

--安装完毕!

--配置ODBC
[root@mshanfengGP Connect64_for_ODBC_71]#cd /opt/Progress/DataDirect/Connect64_for_ODBC_71/
[root@mshanfengGP Connect64_for_ODBC_71]# ll
总用量 452
drwxr-xr-x 7 root root   4096 5月  19 05:37 adminhelp
drwxr-xr-x 2 root root   4096 5月  19 05:37 bin
drwxr-xr-x 5 root root   4096 5月  19 05:37 bind
-rwxr-xr-x 1 root root   2500 5月  19 05:37 DDODBC.LIC
drwxrwxr-x 6 1494  800   4096 4月   9 16:50 help
drwxr-xr-x 2 root root   4096 5月  19 05:37 include
drwxr-xr-x 3 root root   4096 5月  19 05:37 lib
-rw-r--r-- 1 root root  58888 5月  19 05:37 license.txt
drwxr-xr-x 3 root root   4096 5月  19 05:37 locale
-rw-r--r-- 1 root root  57876 5月  19 05:37 NOTICES.TXT
-rw-r--r-- 1 root root 160879 5月  19 05:37 ODBC64FIXES.TXT
-rw-r--r-- 1 root root 111833 5月  19 05:37 ODBC64README.TXT
-rw-r--r-- 1 root root    361 5月  19 05:37 odbc.csh
-rw-r--r-- 1 root root   1120 5月  19 05:37 odbc.ini
-rw-r--r-- 1 root root    694 5月  19 05:37 odbcinst.ini
-rw-r--r-- 1 root root    386 5月  19 05:37 odbc.sh
drwxr-xr-x 7 root root   4096 5月  19 05:37 samples
drwxr-xr-x 2 root root   4096 5月  19 05:37 tools
drwxr-xr-x 3 root root   4096 5月  19 05:37 wizards

[root@mshanfengGP Connect64_for_ODBC_71]# more odbc.sh
if [ "$LD_LIBRARY_PATH" = "" ]; then
        LD_LIBRARY_PATH=/opt/Progress/DataDirect/Connect64_for_ODBC_71/lib
else
        LD_LIBRARY_PATH=/opt/Progress/DataDirect/Connect64_for_ODBC_71/lib:$LD_LIBRARY_PATH
fi
export LD_LIBRARY_PATH
ODBCINI=/opt/Progress/DataDirect/Connect64_for_ODBC_71/odbc.ini
export ODBCINI
ODBCINST=/opt/Progress/DataDirect/Connect64_for_ODBC_71/odbcinst.ini
export ODBCINST

[root@mshanfengGP study]# vi /etc/profile
#添加:
#greenplum的odbc驱动环境
source /opt/Progress/DataDirect/Connect64_for_ODBC_71/odbc.sh

[root@mshanfengGP Connect64_for_ODBC_71]# source /etc/profile
[root@mshanfengGP Connect64_for_ODBC_71]# vi odbc.ini
[Greenplum Wire Protocol]
Database=msfdb
HostName=localhost
LogonID=gpadmin
Password=
PortNumber=5432

[root@mshanfengGP Connect64_for_ODBC_71]# cd bin
[root@mshanfengGP bin]# ./ddtestlib ddgplm27.so      --核实下驱动版本
Load of ddgplm27.so successful, qehandle is 0x136C060
File version: 07.16.0287 (B0391, U0256)


--测试能否通过ODBC访问数据库
[root@mshanfengGP Connect64_for_ODBC_71]# cd /opt/Progress/DataDirect/Connect64_for_ODBC_71/samples/example
[root@mshanfengGP example]# ll
总用量 52
-rw-r--r-- 1 1494 800  2629 2月  27 2014 ddlogging.properties
-rwxrwxr-x 1 1494 800 21572 8月   7 2010 example
-rw-r--r-- 1 1494 800 11669 1月  11 2012 example.c
-rw-r--r-- 1 1494 800  1868 1月  11 2012 example.h
-rw-r--r-- 1 1494 800  1349 1月  17 2012 example.mak
-rw-r--r-- 1 1494 800  2043 1月  11 2012 example.txt
[root@mshanfengGP example]# 
[root@mshanfengGP example]# ./example
./example DataDirect Technologies, Inc. ODBC Example Application.

Enter the data source name : Greenplum Wire Protocol

Enter the user name        : gpadmin

Enter the password         : 

Enter SQL statements (Press ENTER to QUIT)
SQL> select version();

version    
PostgreSQL 8.2.15 (Greenplum Database 4.3.8.2 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on May  9 2016 22:28:40

Enter SQL statements (Press ENTER to QUIT)
SQL> select * from schema_1.a;

i    
1    
2    
3    

Enter SQL statements (Press ENTER to QUIT)
SQL> 

--2、安装perl的ODBC模块

[root@mshanfengGP samples]# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.

cpan[1]> install DBD::ODBC

--注:上述方式安装失败。。。

--更换方式如下:

--网上说要提前安装这俩,不安装可能对下面的安装有影响报错。

--安装Test-Simple
[root@mshanfengGP Test-Simple-1.302136]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Test::Simple
Writing MYMETA.yml and MYMETA.json
[root@mshanfengGP Test-Simple-1.302136]# make&make install
[4] 7838
cp lib/Test/Builder/Formatter.pm blib/lib/Test/Builder/Formatter.pm
cp lib/Test/Builder.pm blib/lib/Test/Builder.pm
cp lib/Test/Builder/IO/Scalar.pm blib/lib/Test/Builder/IO/Scalar.pm
cp lib/Test2/EventFacet/About.pm blib/lib/Test2/EventFacet/About.pm
。。。
Installing /usr/local/share/man/man3/Test2::API::Stack.3
Installing /usr/local/share/man/man3/Test2.3
Installing /usr/local/share/man/man3/Test2::Event::Plan.3
Installing /usr/local/share/man/man3/Test2::Util::ExternalMeta.3
Installing /usr/local/share/man/man3/Test2::Event::TAP::Version.3
Installing /usr/local/share/man/man3/Test::Builder::Module.3
Installing /usr/local/share/man/man3/Test2::EventFacet::Meta.3
Installing /usr/local/share/man/man3/Test2::Transition.3
Appending installation info to /usr/local/lib/perl5/5.26.1/x86_64-linux/perllocal.pod
[4]   Done                    make

--安装ExtUtils-MakeMaker
[root@mshanfengGP ~]# wget http://search.cpan.org/CPAN/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
--2018-05-19 07:26:29--  http://search.cpan.org/CPAN/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
正在解析主机 search.cpan.org... 199.15.176.188
正在连接 search.cpan.org|199.15.176.188|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz [跟随至新的 URL]
--2018-05-19 07:26:32--  http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz
正在解析主机 www.cpan.org... 151.101.74.49, 2a04:4e42:36::561
正在连接 www.cpan.org|151.101.74.49|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:471349 (460K) [application/x-gzip]
正在保存至: “ExtUtils-MakeMaker-7.34.tar.gz”

100%[===================================================================================================================>] 471,349     1.22M/s   in 0.4s    

2018-05-19 07:26:35 (1.22 MB/s) - 已保存 “ExtUtils-MakeMaker-7.34.tar.gz” [471349/471349])

[root@mshanfengGP ExtUtils-MakeMaker-7.34]# perl Makefile.PL
Using included version of ExtUtils::Install (2.06) as it is newer than the installed version (2.04).
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for ExtUtils::MakeMaker
Writing MYMETA.yml and MYMETA.json

[root@mshanfengGP ExtUtils-MakeMaker-7.34]# make&make install
[3] 8249
cp lib/ExtUtils/MakeMaker/FAQ.pod blib/lib/ExtUtils/MakeMaker/FAQ.pod
cp lib/ExtUtils/MM_UWIN.pm blib/lib/ExtUtils/MM_UWIN.pm
cp lib/ExtUtils/MakeMaker/version/vpp.pm blib/lib/ExtUtils/MakeMaker/version/vpp.pm
cp lib/ExtUtils/MM_VMS.pm blib/lib/ExtUtils/MM_VMS.pm
cp lib/ExtUtils/Command/MM.pm blib/lib/ExtUtils/Command/MM.pm
cp lib/ExtUtils/MakeMaker/Config.pm blib/lib/ExtUtils/MakeMaker/Config.pm
cp lib/ExtUtils/MM_Cygwin.pm blib/lib/ExtUtils/MM_Cygwin.pm
cp lib/ExtUtils/MakeMaker/version/regex.pm blib/lib/ExtUtils/MakeMaker/version/regex.pm
cp lib/ExtUtils/MM_Win32.pm blib/lib/ExtUtils/MM_Win32.pm
cp lib/ExtUtils/MM_Darwin.pm blib/lib/ExtUtils/MM_Darwin.pm
Skip blib/lib/ExtUtils/MakeMaker/version/vpp.pm (unchanged)
Skip blib/lib/ExtUtils/MakeMaker/FAQ.pod (unchanged)
。。。
Installing /usr/local/share/man/man3/ExtUtils::MM_UWIN.3
Installing /usr/local/share/man/man3/ExtUtils::MM_MacOS.3
Installing /usr/local/share/man/man3/ExtUtils::MM_Darwin.3
Installing /usr/local/bin/instmodsh
Appending installation info to /usr/local/lib/perl5/5.26.1/x86_64-linux/perllocal.pod
[3]   Done                    make


--安装DBD-ODBC
[root@mshanfengGP ~]# wget http://search.cpan.org/CPAN/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.58.tar.gz
--2018-05-19 06:35:41--  http://search.cpan.org/CPAN/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.58.tar.gz
正在解析主机 search.cpan.org... 199.15.176.188
正在连接 search.cpan.org|199.15.176.188|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.58.tar.gz [跟随至新的 URL]
--2018-05-19 06:35:43--  http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.58.tar.gz
正在解析主机 www.cpan.org... 151.101.74.49, 2a04:4e42:36::561
正在连接 www.cpan.org|151.101.74.49|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:281722 (275K) [application/x-gzip]
正在保存至: “DBD-ODBC-1.58.tar.gz”

100%[===================================================================================================================>] 281,722      850K/s   in 0.3s    

2018-05-19 06:35:46 (850 KB/s) - 已保存 “DBD-ODBC-1.58.tar.gz” [281722/281722])

[root@mshanfengGP ~]# ll
总用量 17192
-rw-------. 1 root root     1159 5月   6 19:49 anaconda-ks.cfg
-rw-r--r--  1 root root   281722 3月  20 23:38 DBD-ODBC-1.58.tar.gz
drwxr-xr-x  6 1000 1000     4096 5月  16 14:57 DBD-Pg-3.7.4
-rw-r--r--  1 root root   261212 5月  16 14:22 DBD-Pg-3.7.4.tar.gz
drwxr-xr-x. 2 root root     4096 5月  19 03:04 gpAdminLogs
-rw-r--r--. 1 root root    13549 5月   6 19:49 install.log
-rw-r--r--. 1 root root     3482 5月   6 19:48 install.log.syslog
-rw-r--r--  1 root root 16939588 9月  23 2017 perl-5.26.1.tar.gz
drwxrwxr-x  5 1000 1000     4096 5月  16 09:18 XML-Simple-2.25
-rw-r--r--  1 root root    78443 3月  18 11:19 XML-Simple-2.25.tar.gz
[root@mshanfengGP ~]# tar xzvf DBD-ODBC-1.58.tar.gz 
。。。
[root@mshanfengGP DBD-ODBC-1.58]# perl Makefile.PL

**********
        Remember to actually *READ* the README file!
        And re-read it if you have any problems.

**********

OSNAME: linux
LANG: zh_CN.UTF-8
ODBCHOME: /opt/Progress/DataDirect/Connect64_for_ODBC_71/
LD_LIBRARY_PATH: /opt/Progress/DataDirect/Connect64_for_ODBC_71/lib:/opt/Progress/DataDirect/Connect64_for_ODBC_71/lib
DBROOT: 
WINDIR: 
II_SYSTEM: 
DBD_ODBC_UNICODE: 
Perl: 5.026001
ExtUtils::MakeMaker: 7.34
Command line options:
  w! = undef
  x! = undef
  o=s = 
  u! = undef
  e! = undef
  g! = 0


Your LANG environment variable is set to "zh_CN.UTF-8"
This is known to cause problems in some perl installations - even stopping
this Makefile.PL from running without errors. If you have problems please
try re-running with LANG unset or with the utf part of LANG removed.

Looking for odbc_config in : /opt/Progress/DataDirect/Connect64_for_ODBC_71/
Looking for odbc_config at /opt/Progress/DataDirect/Connect64_for_ODBC_71//bin/odbc_config
Looking for odbc_config in (PATH) /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/soft/jdk8/bin::/root/bin

***** WARNING *****
You provided ODBCHOME (/opt/Progress/DataDirect/Connect64_for_ODBC_71/)
which has no odbc_config (not unusual for older unixODBCs)
but we've found an odbc_config on your PATH. It is unlikely the
odbc_config specifications are going to match your specified ODBCHOME
so this script is going to ignore your specified ODBCHOME. If you don't
like this do something  to remove odbc_config from your PATH or ensure
there is an odbc_config in your provided ODBCHOME.

Press return to continue...  
  Found odbc_config (via odbc_config) version 2.2.14

  odbc_config reports --prefix=/usr
  odbc_config reports --include-prefix=/usr/include
  odbc_config reports --lib-prefix=/usr/lib64
  but cannot find header files sql.h,sqlext.h,sqltypes.h in that path so ignoring
NOTE: Have you installed the unixodbc-dev package
Looking for iodbc-config in PATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/soft/jdk8/bin::/root/bin
  iodbc_config not found
odbc_config not found - ok, there are other things I can do
Still trying to guess ODBCHOME - looking for headers now
  trying /opt/Progress/DataDirect/Connect64_for_ODBC_71/include
  Found sql.h, sqlext.h, sqltypes.h in /opt/Progress/DataDirect/Connect64_for_ODBC_71/include
Using ODBCHOME /opt/Progress/DataDirect/Connect64_for_ODBC_71/
  Looking for iODBC libs in /opt/Progress/DataDirect/Connect64_for_ODBC_71//lib
  Looking for iODBC libs in /usr/local/lib
  Looking for iODBC libs in /usr/lib
  Looking for iODBC libs in /lib/../lib64
  Looking for iODBC libs in /usr/lib/../lib64
  Looking for iODBC libs in /lib
  Looking for iODBC libs in /lib64
  Looking for iODBC libs in /usr/lib64
  Looking for iODBC libs in /usr/local/lib64
  Looking for iODBC libs in /opt/Progress/DataDirect/Connect64_for_ODBC_71/
  Looking for iODBC libs in /opt/Progress/DataDirect/Connect64_for_ODBC_71//lib
  Looking for unixODBC libs in /opt/Progress/DataDirect/Connect64_for_ODBC_71//lib
    Found unixODBC libs /opt/Progress/DataDirect/Connect64_for_ODBC_71//lib/libodbc.so,/opt/Progress/DataDirect/Connect64_for_ODBC_71//lib/libodbcinst.so in /opt/Progress/DataDirect/Connect64_for_ODBC_71//lib

This looks like a unixodbc type of driver manager.
Looking for odbcinst
  odbcinst not found - ok, I can deal with that.
Looking for odbc_config to get cflags
  odbc_config not found - ok
Warning: LD_LIBRARY_PATH=/opt/Progress/DataDirect/Connect64_for_ODBC_71/lib:/opt/Progress/DataDirect/Connect64_for_ODBC_71/lib doesn't include /opt/Progress/DataDirect/Connect64_for_ODBC_71//lib

Using DBI 1.641 (for perl 5.026001 on x86_64-linux) installed in /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBI/
Using DBI 1.641 (for perl 5.026001 on x86_64-linux) installed in /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBI/
Generating a Unix-style Makefile
Writing Makefile for DBD::ODBC
Writing MYMETA.yml and MYMETA.json
Warning: not all required environment variables are set.

Warning: Will not be able to run tests as you have not defined
all of DBI_DSN, DBI_USER and DBI_PASS environment variables.
[root@mshanfengGP DBD-ODBC-1.58]# make
Skip blib/lib/DBD/ODBC.pm (unchanged)
Running Mkbootstrap for ODBC ()
chmod 644 "ODBC.bs"
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- ODBC.bs blib/arch/auto/DBD/ODBC/ODBC.bs 644
cc -c -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include  -I. -I/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBI -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"1.58\" -DXS_VERSION=\"1.58\" -fPIC "-I/usr/local/lib/perl5/5.26.1/x86_64-linux/CORE"  -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include ConvertUTF.c
cc -c -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include  -I. -I/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBI -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"1.58\" -DXS_VERSION=\"1.58\" -fPIC "-I/usr/local/lib/perl5/5.26.1/x86_64-linux/CORE"  -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include ODBC.c
cc -c -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include  -I. -I/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBI -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"1.58\" -DXS_VERSION=\"1.58\" -fPIC "-I/usr/local/lib/perl5/5.26.1/x86_64-linux/CORE"  -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include dbdimp.c
cc -c -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include  -I. -I/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBI -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"1.58\" -DXS_VERSION=\"1.58\" -fPIC "-I/usr/local/lib/perl5/5.26.1/x86_64-linux/CORE"  -I/opt/Progress/DataDirect/Connect64_for_ODBC_71/include unicode_helper.c
rm -f blib/arch/auto/DBD/ODBC/ODBC.so
LD_RUN_PATH="/opt/Progress/DataDirect/Connect64_for_ODBC_71//lib" cc  -shared -O2 -L/usr/local/lib -fstack-protector  ConvertUTF.o ODBC.o dbdimp.o unicode_helper.o  -o blib/arch/auto/DBD/ODBC/ODBC.so  \
           -L/opt/Progress/DataDirect/Connect64_for_ODBC_71//lib -lodbc   \
          
chmod 755 blib/arch/auto/DBD/ODBC/ODBC.so
Manifying 1 pod document
[root@mshanfengGP DBD-ODBC-1.58]# 
[root@mshanfengGP DBD-ODBC-1.58]# 
[root@mshanfengGP DBD-ODBC-1.58]# 
[root@mshanfengGP DBD-ODBC-1.58]# make install
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- ODBC.bs blib/arch/auto/DBD/ODBC/ODBC.bs 644
Manifying 1 pod document
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/auto/DBD/ODBC/ODBC.so
Installing /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/DBD/ODBC.pm
Installing /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/DBD/ODBC/FAQ.pm
Installing /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/DBD/ODBC/TO_DO.pm
Installing /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/DBD/ODBC/Changes.pm
Installing /usr/local/share/man/man3/DBD::ODBC.3
Appending installation info to /usr/local/lib/perl5/5.26.1/x86_64-linux/perllocal.pod
[root@mshanfengGP DBD-ODBC-1.58]# 
[root@mshanfengGP DBD-ODBC-1.58]# 
[root@mshanfengGP DBD-ODBC-1.58]# perl -e 'use DBI 1.625;'   --无输出,说明安装成功

--整个安装结果:
[root@mshanfengGP DBD-ODBC-1.58]# perl -MDBI -e'DBI->installed_versions;'
  Perl            : 5.026001    (x86_64-linux)
  OS              : linux       (2.6.32-573.el6.x86_64)
  DBI             : 1.641
  DBD::Sponge     : 12.010003
  DBD::Proxy      : install_driver(Proxy) failed: Can't locate RPC/PlClient.pm in @INC (you may need to install the RPC::PlClient module)
  DBD::Pg         : 3.7.4
  DBD::ODBC       : 1.58
  DBD::Mem        : 0.001
  DBD::Gofer      : 0.015327
  DBD::File       : 0.44
  DBD::ExampleP   : 12.014311
  DBD::DBM        : 0.08

---perl脚本测试:
[root@mshanfengGP study]# more db.pl
#!/bin/perl
use DBI;

my $sth;
my @tabrow;

#my $dbh=DBI->connect("DBI:Pg:dbname=msfdb;host=localhost;port=5432","gpadmin","",{AutoCommit =>1});
my $dbh =DBI->connect("dbi:ODBC:Greenplum Wire Protocol",gpadmin,"");

my $sql_str="select * from schema_1.a";

$sth=$dbh->prepare($sql_str);
$sth->execute();
@tabrow=$sth->fetchrow();
$result=@tabrow[0];
$sth->finish();
$dbh->disconnect();
print $result."\n";

[root@mshanfengGP study]# perl db.pl
1
[root@mshanfengGP study]#  




--------------------
参考:http://gpdb.docs.pivotal.io/580/datadirect/datadirect_ODBC_71.html#topic5
     https://blog.csdn.net/jiangshouzhuang/article/details/27485991

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页