ITPub博客

首页 > Linux操作系统 > Linux操作系统 > perl for dba:example:working with database

perl for dba:example:working with database

原创 Linux操作系统 作者:xhailiang 时间:2007-03-15 00:00:00 0 删除 编辑

I:

01: #!/usr/bin/perl -w
02: # connect_test.pl
03: # Chapter 2
04: # Listing 1
05: use strict;
06: use DBI;
07: print "Available Database Drivers:n";
08: print "*" x 40, "n";
09: print join("n", DBI->available_drivers()), "nn";

II:

01:$EVN{"ORACLE_HOME"}="/home/oracle/ora9i"

01:my $constr=DBI->connect("DBI:Oracle:orasid","orauser","password"

02:) ||die("Cannot connect :$DBI::errstr");

03:my $sql = qq(select sysdate from dual);

04:my $sql_result = $constr->prepare($sql);
III:

05:while (my $p = $sql_result->fetch) {print "@$p n";}

06:$constr->disconnect;


#!/usr/bin/perl -w
run perl dbi module with warning

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/308563/viewspace-171973/,如需转载,请注明出处,否则将追究法律责任。

下一篇: LVM
请登录后发表评论 登录
全部评论

注册时间:2008-02-17

  • 博文量
    270
  • 访问量
    417304