u are using the right one.
?
Press return to continue... Looking for odbc_config in : nowhere
Looking for odbc_config in (PATH)/usr/local/greenplum-connectivity-4.3.0.0-build-2/bin:/sybaseclient/IQ-16_0/bin64:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/local/freetds0.91/bin:/usr/bin:/sybaseclient/IQ-16_0/bin64:/home/hadoop/nodesetup/java/jdk1.6.0_29/bin:/sybaseclient/IQ-16_0/lib64
Found odbc_config (via odbc_config) version 2.2.12
?
odbc_config reports --prefix=/usr
odbc_config reports --include-prefix=/usr/include
odbc_config reports --lib-prefix=/usr/lib64
butcannot find header files sql.h,sqlext.h,sqltypes.h in that path so ignoring
NOTE: Have you installed the unixodbc-devpackage
Looking for iodbc-config in PATH /usr/local/greenplum-connectivity-4.3.0.0-build-2/bin:/sybaseclient/IQ-16_0/bin64:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/local/freetds0.91/bin:/usr/bin:/sybaseclient/IQ-16_0/bin64:/home/hadoop/nodesetup/java/jdk1.6.0_29/bin:/sybaseclient/IQ-16_0/lib64
iodbc_config not found
odbc_config not found - ok, there are otherthings I can do
Still trying to guess ODBCHOME - lookingfor headers now
trying /usr/include
trying /usr/local/include
trying /usr/pkg/include
trying /usr/local/easysoft/unixODBC/include
?
I cannot find drivermanager header files. Perhaps you need to install the
unixodbc-dev package orthe iodbc-dev package
?
?
The DBD::ODBC moduleneeds to link with an ODBC 'Driver Manager'.
(The Driver Manager, inturn, needs one or more database specific ODBC
drivers. The DBD::ODBCmodule does _not_ include any ODBC drivers!)
?
You need to indicate where your ODBC DriverManager is installed.
You can do this by:
?
o setting the ODBCHOME environment variable
o running 'perl Makefile.PL -o odbcdir'
o adding path to odbc_config/iodbc_configto PATH
?
If you do not have an ODBC Driver Manageryou should try to get hold of
the unixODBC packages for your system orbuild it from source (see
http://www.unixodbc.org). If you installdriver manager packages you
need to include the "XXX-dev"package which includes the C header files.
?
上面的主要问题是没有设置如下变量导致的:
export ODBCHOME=/usr/local/unixODBC
export LD_LIBRARY_PATH=/usr/local/unixODBC/lib
?
但是我们安装的unixODBC是RPM形式的包,安装后的目录不满足要求,所以我们需要重新编译安装unixODBC:
解压unixODBC-2.3.2.tar.gz包并安装
tar -zxvf unixODBC-2.3.2.tar.gz
./configure --prefix=/usr/local/unixODBC
make
make install
?
unixODBC安装好之后,设置环境变量:
export ODBCHOME=/usr/local/unixODBC
export LD_LIBRARY_PATH=/usr/local/unixODBC/lib
然后再重新安装DBD-ODBC驱动,就可以成功安装了。
?
同时不要忘记,将之前配置的/etc/unixODBC/odbc.ini和/etc/unixODBC/odbcinst.ini文件都拷贝到/usr/local/unixODBC/etc目录下面,因为Perl脚本将/usr/local/unixODBC/etc这里获取GP的数据库配置驱动信息。
测试perl脚本
(1) 准备perl测试脚本,如下:
linux-82:/etc/unixODBC
#!/usr/bin/perl
####################################################################
# name:hellokitty.pl
#describe: 测试perl访问Greenplum数据库
####################################################################
use DBI;
usestrict;
usePOSIX;
#判断入参个数:dbname数据库名; dbuser 用户名; p