DBI-Modul and Oracle 9i
411268Dec 26 2003 — edited Dec 26 2003Hello,
I can't connect to an Oracle database. I tried several handler I got from CPAN (see script)!
Thank you
-----------------
Perl script:
use DBI;
use DBD::Oracle;
$user = "scott";
$passwd = "tiger";
#Which DB handler is better and how do I have to change them
#to make them work with an Oracle 9i database? I tried several ways but nothing worked!
# The value of ORACLE_HOME is C:\oracle\ora92
#$dbh = DBI->connect("dbi:Oracle:host=machine-0560nntbn1;sid=oracle", $user, $passwd);
#$dbh = DBI->connect('dbi:Oracle:host=machine-0560nntbn1;sid=oracle;port=1521', 'scott/tiger', '');
BEGIN {
$ENV{ORACLE_HOME} = '/home/oracle/product/7.x.x';
$ENV{TWO_TASK} = 'DB';
}
$dbh = DBI->connect('dbi:Oracle:','scott', 'tiger');
$sth = $dbh->prepare("CREATE TABLE names (id INTEGER, sname VARCHAR(20), fname VARCHAR(20))");
$sth->execute();
$sth->finish;
$dbh->disconnect;