Linux系统下perl脚本连接OB数据库

Perl脚本怎么连接OB 麻烦提供下例子代码 谢谢

#!/usr/bin/perl -w

use strict;
use DBI;

my $host = “localhost”;
my $driver = “mysql”;
my $database = “RUNOOB”;

my $dsn = “DBI:$driver:database=$database:$host”;
my $userid = “root”;
my $password = “123456”;

连接数据库

my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::errstr;
my $sth = $dbh->prepare(“SELECT * FROM Websites”);
$sth->execute();

while ( my @row = $sth->fetchrow_array() )
{
print join(’\t’, @row)."\n";
}

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

2 个赞

就当mysql 的方式去连接就好了

谢谢您的回答。但我们采用的是Oracle模式,用mysql驱动去连接OB数据库能成功吗?或者有没有连接ORACLE模式的脚本源码例子看看,谢谢您

这个不能的,oracle 模式找一下对应的SA或者支持人员吧