[英]Can I access Postgre database on another machine using Perl, DBI, and DBD::Pg?
這是我需要的嗎? 這是在我的系統上。
lrwxrwxrwx 1 root root 12 May 1 20:05 /usr/lib/libpq.so.4 -> libpq.so.4.1*
-rwxr-xr-x 1 root root 130K Feb 27 07:36 /usr/lib/libpq.so.4.1*
目標:我想從另一台機器上的Postgres服務器中獲取數據。 我已經有數據庫機器的數據庫用戶名,密碼,IP。
使用cpanm我安裝了DBI很好,沒有錯誤。 當我安裝DBD :: Pg時出現錯誤。 CPAN錯誤日志如下:
cpanm (App::cpanminus) 1.6941 on perl 5.008008 built for i386-linux-thread-multi
Work directory is /root/.cpanm/work/1405531191.27414
You have make /usr/bin/make
You have LWP 6.04
You have /bin/tar: tar (GNU tar) 1.15.1
You have /usr/bin/unzip
Searching DBD::Pg on cpanmetadb ...
--> Working on DBD::Pg
Fetching http://www.cpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.3.0.tar.gz
-> OK
Unpacking DBD-Pg-3.3.0.tar.gz
Entering DBD-Pg-3.3.0
Checking configure dependencies from META.yml
Checking if you have version 0 ... Yes (0.88)
Checking if you have DBI 1.614 ... Yes (1.631)
Configuring DBD-Pg-3.3.0
Running Makefile.PL
Path to pg_config?
No POSTGRES_HOME defined, cannot find automatically
Configuring DBD::Pg 3.3.0
-> N/A
-> FAIL Configure failed for DBD-Pg-3.3.0. See /root/.cpanm/work/1405531191.27414/build.log for details.
如果我能正常工作,那么我的第一步就是僅顯示有關DBI驅動程序的非常基本的信息。 下一步將是在SELECT語句中顯示一個表中的一些字段。
我不會返回數百萬條記錄,但是肯定會返回100條記錄。
謝謝!
如果您使用的系統已經構建並且可用於系統,則不會有任何這些問題。
$ sudo yum install perl-DBD-Pg
... Lots of output snipped ...
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
perl-DBD-Pg x86_64 1.49-4.el5_8 centos-update 115 k
Installing for dependencies:
postgresql-libs x86_64 8.1.23-6.el5_8 centos-update 197 k
Transaction Summary
================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)
Total download size: 312 k
Is this ok [y/N]:
我的示例使用Centos 5.8.8,但它對於RHEL的工作原理應該相同。
當然可以; 畢竟,這是一個客戶端/服務器架構!
您的日志中的錯誤是由於缺少libpq5
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.