|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
|
上次讲了在linux下安装Oracle,安装完之后可以用netac来配置远程数据库的本地命名。mY7Linux联盟 要在perl下面连接oracle数据库,首先必须安装DBI和DBD for Oracle。mY7Linux联盟 下面是一段perl程序mY7Linux联盟 #!/usr/bin/perlmY7Linux联盟 use DBI;mY7Linux联盟 $dbname="oralce";mY7Linux联盟 $user="user";mY7Linux联盟 $passwd="password";mY7Linux联盟 $dbh="";mY7Linux联盟 $dbh = DBI->connect("dbi:Oracle:$dbname",$user,$passwd) or die "can't connect tomY7Linux联盟 database ". DBI-errstr;mY7Linux联盟 //连接数据库mY7Linux联盟 $sth=$dbh->prepare("select * from tDevice");mY7Linux联盟 $sth->execute;mY7Linux联盟 //执行sql语句mY7Linux联盟 while (@recs=$sth->fetchrow_array) {mY7Linux联盟 print $recs[0].":".$recs[1].":".$recs[2]."\n";mY7Linux联盟 //读取记录数据mY7Linux联盟 }mY7Linux联盟 $dbh->disconnect;mY7Linux联盟 //断开连接mY7Linux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|