彪彪
openkore
全部博文(50)
C编程(0)
软件工具(0)
c++入门(2)
openkore(0)
2010年(38)
2009年(12)
kevin258
wsy52081
ddmumahh
vincerma
raveh
mwx1234
chen_xue
zjwmv
zpbobo11
分类:
2010-04-25 02:45:29
#!/usr/bin/perluse 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;
上一篇:perl and LWP 文档
下一篇:PERL文本对比想法
登录 注册