文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>PERL ORACLE数据库

PERL ORACLE数据库

时间:2010-04-25  来源:openkore

#!/usr/bin/perl


use DBI;
use DBI qw(:sql_types);

#&connectOra;


sub connectOra
{
        my ($strHost,$strUser,$strPasswd) = @_;
        DBI->trace(0);
        my $dbhOra = DBI->connect("dbi:Oracle:${strHost}", ${strUser}, ${strPasswd},
                               { AutoCommit => 1, PrintError => 0, RaiseError => 0 } ) ;
                                                            
        unless (defined($dbhOra) ) { return undef; }

        return $dbhOra;
}








$dbh = DBI->connect("dbi:Oracle:","scott","tiger") or die("DB connect error! \n");

$sql = "select * from emp";
$sth = $dbh->prepare($sql);
$sth->execute() or die("error!");

while(@rows = $sth->fetchrow_array)
{
foreach(@rows)
{
print "$_\t";
}
print "\n";
}

$sth->finish;
$dbh->disconnect();
exit 0;


相关阅读 更多 +
排行榜 更多 +
泡龙大闯关安卓版

泡龙大闯关安卓版

冒险解谜 下载
割草派对安卓版

割草派对安卓版

飞行射击 下载
堡垒攻防战安卓版

堡垒攻防战安卓版

飞行射击 下载