Perl脚本访问Greenplum数据库安装指导(五)

2015-07-24 10:52:28 · 作者: · 浏览: 19
reenplum-connectivity-4.3.0.0-build-2/drivers/odbc/psqlodbc-08.02.0500/unixodbc-2.2.12/psqlodbcw.so ------GP的ODBC驱动

UsageCount=1

FileUsage= 1

?

?

(4) 使用isql测试

linux-82:/etc/unixODBC # isql GreenplumDSN

+---------------------------------------+

| Connected! |

| |

| sql-statement |

| help [tablename] |

| quit |

| |

+---------------------------------------+

SQL> select user;

+-----------------------------------------------------------------+

| current_user |

+-----------------------------------------------------------------+

| noas |

+-----------------------------------------------------------------+

SQLRowCount returns -1

1 rows fetched

SQL>

注:如果你在执行isql时,出现如下情况:

linux-82:/etc/unixODBC # isql GreenplumDSN

[ISQL]ERROR: Could not SQLConnect

?

这个问题很大情况下是你没有source文件greenplum_connectivity_path.sh导致的,执行source greenplum_connectivity_path.sh文件后,再执行就OK了,最好的办法是将source该文件加入到系统环境变量中。

?

安装DBI

(1) 解压DBI安装包

linux-82:/home/PlODBC # tar -zxvfDBI-1.631.tar.gz

?

(2) 查看DBI解压的目录

进入解压的目录,可以查看到Perl模块的安装说明文件INSTALL,里面有段内容为:

perl Makefile.PL

make

make test

make test TEST_VERBOSE=1 (if any of the t/* tests fail)

make install (if the tests look okay)

?

Perl的模块安装,基本上都是这几个步骤,test的内容不做强求,但是建议执行。

?

(3) 执行DBI安装

linux-82:/home/PlODBC/DBI-1.631 # perlMakefile.PL

linux-82:/home/PlODBC/DBI-1.631 # make

linux-82:/home/PlODBC/DBI-1.631 #make install

(4) 测试DBI安装是否成功

linux-82:/home/PlODBC/DBI-1.631 # perl-e 'use DBI 1.625;'

如果没有访问信息,则说明安装成功。

?

?

安装DBD-ODBC驱动

(5) 解压DBD-ODBC安装包

linux-82:/home/PlODBC # tar -zxvfDBD-ODBC-1.48.tar.gz

?

(6) 执行DBD-ODBC安装

perl Makefile.PL

make

make install

?

(7) 测试DBD-ODBC安装是否成功

linux-82:/home/PlODBC # perl -e'use DBD::ODBC;'

如果没有访问信息,则说明安装成功。

?

?

查看DBI整个安装信息:

linux-82:/home/PlODBC # perl -MDBI -e'DBI->installed_versions;'

Perl : 5.010000 (x86_64-linux-thread-multi)

OS : linux (2.6.32)

DBI : 1.631

DBD::Sponge : 12.010003

DBD::Proxy : install_driver(Proxy) failed: Can'tlocate RPC/PlClient.pm in @INC

DBD::ODBC : 1.48

DBD::Gofer : 0.015327

DBD::File : 0.42

DBD::ExampleP : 12.014311

DBD::DBM : 0.08

?

可以看到DBI和DBD-ODBC都已经安装好了。

?

?

注:在编译DBD-ODBC时,如果报如下的错误:

linux-82:/home/PlODBC/DBD-ODBC-1.48 # perlMakefile.PL

?

**********

Rememberto actually *READ* the README file!

Andre-read it if you have any problems.

?

**********

?

OSNAME: linux

LANG: en_US.UTF-8

ODBCHOME:

LD_LIBRARY_PATH: /usr/local/greenplum-connectivity-4.3.0.0-build-2/drivers/odbc/psqlodbc-08.02.0500/datadirect-52_64/:/usr/local/greenplum-connectivity-4.3.0.0-build-2/lib:/sybaseclient/IQ-16_0/lib64:

DBROOT:

WINDIR:

II_SYSTEM:

Perl: 5.010000

ExtUtils::MakeMaker: 6.56

Command line options:

u!= undef

w!= undef

e!= undef

g!= 0

x!= undef

o=s=

?

?

Your LANG environment variable is set to"en_US.UTF-8"

This is known to cause problems in someperl installations - even stopping

this Makefile.PL from running withouterrors. If you have problems please

try re-running with LANG unset or with theutf part of LANG removed.

?

?

You are using a Perl configured withthreading enabled.

Please read the warnings in DBI about this.

?

You should also be aware that onnon-Windows platforms ODBC drivers come

in two forms, thread-safe andnon-thread-safe drivers and you may need

to make sure yo