亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 使用DBI連接Oracle數(shù)據(jù)庫的問題 [打印本頁]

作者: lth0721    時(shí)間: 2010-02-03 09:48
標(biāo)題: 使用DBI連接Oracle數(shù)據(jù)庫的問題
  1. [oracle@localhost perl]$ cat test.pl
  2. #!/u01/app/oracle/product/10.2.0/db_1/perl/bin/perl -w

  3. use strict;
  4. use DBI;
  5. print "ok";
  6. my @ary = DBI->available_drivers;
  7. print "@ary";
  8. my $dbh = DBI->connect("dbi:Oracle:G_192.168.1.171","username","passwd") || die "Couldn't connect to data";
復(fù)制代碼
上面是我的代碼,使用的是Oracle客戶端自帶的perl去連接Oracle數(shù)據(jù)庫。不知道為什么這個(gè)腳本沒法執(zhí)行,一直是停在那里的也沒有任何錯(cuò)誤提示,連第一個(gè)ok都沒用打印出來,如果是把最后一行注釋掉就可以成功執(zhí)行前面的代碼了,不知道有人遇見過這種情況嗎?
  1. [oracle@localhost perl]$ ./test.pl

復(fù)制代碼

作者: Pro_sky    時(shí)間: 2010-02-03 10:24
本帖最后由 Pro_sky 于 2010-02-03 10:26 編輯

不是腳本沒執(zhí)行吧,是連接的時(shí)候在等待,可能超時(shí)時(shí)間比較長(zhǎng)

ok沒打出來應(yīng)該是 被緩存了,你可以設(shè)置 "$| = 1" 或者 print "ok\n"
作者: lth0721    時(shí)間: 2010-02-03 10:41
回復(fù) 2# Pro_sky


    多謝你的回復(fù)啊,確實(shí)是執(zhí)行了 print的,怎么加個(gè)\n 就不會(huì)被緩存了嗎?現(xiàn)在的問題是根本沒有發(fā)包出去啊。。不知道可能是什么原因引起的呢?
作者: yybmsrs    時(shí)間: 2010-02-03 10:47
print "@ary";

打印出了什么?
作者: lth0721    時(shí)間: 2010-02-03 10:49
回復(fù) 4# yybmsrs


    ExampleP Oracle Proxy Sponge


以前都是可以連接的不知道為什么突然就不能連接了
作者: Pro_sky    時(shí)間: 2010-02-03 10:59
回復(fù) 3# lth0721


    perl跟C應(yīng)該一樣,標(biāo)準(zhǔn)輸出是按行緩存的
作者: lth0721    時(shí)間: 2010-02-03 12:42
我現(xiàn)在把這個(gè)腳本換到另一臺(tái)機(jī)器執(zhí)行,結(jié)果提示
./test.pl
Can't locate strict.pm in @INC (@INC contains: /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl .) at ./test.pl line 2.
BEGIN failed--compilation aborted at ./test.pl line 2.

但是我是有strict的啊
[oracle@63-216-146-37 perl]$ locate strict.pm
/u01/app/oracle/product/10.2.0/db_1/perl/lib/5.8.3/strict.pm
作者: Pro_sky    時(shí)間: 2010-02-03 13:10
回復(fù) 7# lth0721

push @INC, "/u01/app/oracle/product/10.2.0/db_1/perl/lib/5.8.3/";

或者

use lib '/u01/app/oracle/product/10.2.0/db_1/perl/lib/5.8.3/';
作者: lth0721    時(shí)間: 2010-02-03 14:05
回復(fù) 8# Pro_sky
  1. [oracle@63-216-146-37 perl]$ ./test.pl
  2. Can't locate lib.pm in @INC (@INC contains: /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl .) at ./test.pl line 2.
  3. BEGIN failed--compilation aborted at ./test.pl line 2.
復(fù)制代碼
不曉得是什么問題啊。。難道是需要設(shè)置什么環(huán)境變量嗎?
作者: Ray001    時(shí)間: 2010-02-03 14:43
Can't locate lib.pm
這個(gè)是pm沒裝全。
作者: Ray001    時(shí)間: 2010-02-03 14:46
G_192.168.1.171","username","passwd"
這幾個(gè)貌似不對(duì)吧,sid是這個(gè)?用戶名是這個(gè)?密碼是這個(gè)?
作者: lth0721    時(shí)間: 2010-02-03 14:53
回復(fù) 11# Ray001


    這個(gè)肯定是個(gè)假的啊。。就算不是真的也應(yīng)該會(huì)報(bào)錯(cuò)或者發(fā)包到server 吧?!,F(xiàn)在是什么反應(yīng)都沒有。。換到另一臺(tái)機(jī)器執(zhí)行又出現(xiàn)上面的問題

作者: lth0721    時(shí)間: 2010-02-03 14:57
回復(fù) 10# Ray001


    是裝全了的,我用的是oracle client自帶的perl,也是能找到這些pm的,就是不知道為什么腳本里面就找不到了,而且我修改了@INC好像也沒有起作用,
  1. [oracle@63-216-146-37 perl]$ cat test.pl
  2. #!/u01/app/oracle/product/10.2.0/db_1/perl/bin/perl -w
  3. push @INC, "/u01/app/oracle/product/10.2.0/db_1/perl/";
  4. use DBI;



  5. [oracle@63-216-146-37 perl]$ ./test.pl
  6. Can't locate DBI.pm in @INC (@INC contains: /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl .) at ./test.pl line 7.
  7. BEGIN failed--compilation aborted at ./test.pl line 7.
復(fù)制代碼

作者: Ray001    時(shí)間: 2010-02-03 15:14
DBI-1.609.tar.gz
DBD-Oracle-1.23.readme
樓主是沒裝這2個(gè)東西吧。
作者: lth0721    時(shí)間: 2010-02-03 15:23
裝了的吧。。
  1. [oracle@63-216-146-37 perl]$ locate DBI
  2. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/Apache/AuthDBI.pm
  3. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/Apache/DBI.pm
  4. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBI
  5. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBI.pm

  6. [oracle@63-216-146-37 perl]$ locate DBD
  7. /home/oracle/client/stage/Components/oracle.oem.client/10.2.0.1.0/1/DataFiles/Expanded/filegroup92/DBDiffSplash.gif
  8. /home/oracle/client/stage/Components/oracle.oem.client/10.2.0.1.0/1/DataFiles/Expanded/filegroup95/DBDiff32x32.gif
  9. /home/oracle/client/stage/Components/oracle.oem.client/10.2.0.1.0/1/DataFiles/Expanded/filegroup95/DBDiffTop.gif
  10. /home/oracle/client/stage/Dialogs/HTMLDBDialogs
  11. /home/oracle/client/stage/Dialogs/HTMLDBDialogs/10.2.0.1.0
  12. /home/oracle/client/stage/Dialogs/HTMLDBDialogs/10.2.0.1.0/1
  13. /home/oracle/client/stage/Dialogs/HTMLDBDialogs/10.2.0.1.0/1/HTMLDBDialogs.jar
  14. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBD
  15. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBD/ExampleP.pm
  16. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBD/NullP.pm
  17. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBD/Oracle
  18. /u01/app/oracle/product/10.2.0/db_1/perl/lib/site_perl/5.8.3/i686-linux-thread-multi/DBD/Oracle.pm

復(fù)制代碼

作者: Ray001    時(shí)間: 2010-02-03 16:04
環(huán)境變量的問題,把/usr/opt/perl5/bin加入的PATH
作者: lth0721    時(shí)間: 2010-02-03 16:17
回復(fù) 16# Ray001


    兄弟。。我沒有/usr/opt/perl5/bin這個(gè)目錄耶。。。我把/u01/app/oracle/product/10.2.0/db_1/perl/bin/加進(jìn)去還是不行
  1. [oracle@localhost perl]$ ./test.pl
  2. Can't locate DBI.pm in @INC (@INC contains: /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3/i686-linux-thread-multi /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl/5.8.3 /ade/smayer_perl58_main_linux/perl58/bin/Linux/Opt/lib/site_perl .) at ./test.pl line 2.
  3. BEGIN failed--compilation aborted at ./test.pl line 2
復(fù)制代碼
而且@INC里面那些目錄我的機(jī)器上也是沒有的,不知道是怎么回事
作者: lth0721    時(shí)間: 2010-02-03 17:42
準(zhǔn)備不用Oracle自帶的perl,自己去裝DBI和DBD::Oracle,沒想到在成功安裝了DBI后安裝DBD就一直停在那里不動(dòng)了,大俠救命啊
  1. [oracle@grchengdu_testserver DBD-Oracle-1.23]$ perl Makefile.PL
  2. Multiple copies of Driver.xst found in: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ at Makefile.PL line 37
  3. Using DBI 1.609 (for perl 5.008008 on i386-linux-thread-multi) installed in /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/

  4. Configuring DBD::Oracle for perl 5.008008 on linux (i386-linux-thread-multi)

  5. Remember to actually *READ* the README file! Especially if you have any problems.

  6. Installing on a linux, Ver#2.6
  7. Using Oracle in /u01/app/oracle/product/10.2.0/db_1

復(fù)制代碼

作者: 蘭花仙子    時(shí)間: 2010-02-03 20:08
回復(fù)  Ray001


    是裝全了的,我用的是oracle client自帶的perl,也是能找到這些pm的,就是不知道為 ...
lth0721 發(fā)表于 2010-02-03 14:57



    修改@INC要在BEGIN里,因?yàn)閘oad是在編譯時(shí)發(fā)生。
BEGIN {
    push @INC, "/u01/app/oracle/product/10.2.0/db_1/perl/";
}
作者: 蘭花仙子    時(shí)間: 2010-02-03 20:10
準(zhǔn)備不用Oracle自帶的perl,自己去裝DBI和DBD::Oracle,沒想到在成功安裝了DBI后安裝DBD就一直停在那里不動(dòng) ...
lth0721 發(fā)表于 2010-02-03 17:42

  1.     perl Makefile.PL --help
復(fù)制代碼
看看,我記得要指定oracle的一些path。
作者: lth0721    時(shí)間: 2010-02-03 21:48
本帖最后由 lth0721 于 2010-02-03 22:04 編輯

回復(fù) 20# 蘭花仙子
  1. [oracle@grchengdu_testserver DBD-Oracle-1.23]$ perl Makefile.PL --help
  2. Multiple copies of Driver.xst found in: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ at Makefile.PL line 37
  3. Using DBI 1.609 (for perl 5.008008 on i386-linux-thread-multi) installed in /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/
  4. Unknown option: help
  5. Invalid arguments at Makefile.PL line 101.
復(fù)制代碼
沒的這個(gè)選項(xiàng)。。。

我執(zhí)行perl Makefile.PL 的時(shí)候是設(shè)置了oracle_home還有LD_LIBRARY_PATH這個(gè)環(huán)境變量的,執(zhí)行的時(shí)候也沒有報(bào)錯(cuò)就是不知道為什么到了Using Oracle in /u01/app/oracle/product/10.2.0/db_1那一步就卡住不動(dòng)了
  1. [root@grchengdu_testserver DBD-Oracle-1.23]# perl Makefile.PL
  2. Multiple copies of Driver.xst found in: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBI/ at Makefile.PL line 37
  3. Using DBI 1.609 (for perl 5.008008 on i386-linux-thread-multi) installed in /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/DBI/

  4. Configuring DBD::Oracle for perl 5.008008 on linux (i386-linux-thread-multi)

  5. Remember to actually *READ* the README file! Especially if you have any problems.

  6. Installing on a linux, Ver#2.6
  7. Using Oracle in /u01/app/oracle/product/10.2.0/db_1
復(fù)制代碼





歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2