Hi,
I recently tested and installed the DBI and DBD:Oracle modules.I am a beginner
to using
DBI to connect to the Database. My first task is to connect to an Oracle Database
using a 7.3.4
Oracle Client, with the SQL statement as "SELECT * FROM TAB"
My program is as follows:
#!/usr/local/bin/perl
use DBI;
my $dbuser = $ENV{ORACLE_USERID} || 's1_gwy/s1_gwy01';
my $dbh = DBI->connect('DBI:Oracle:', $dbuser, '')
or die "Couldnt connect to database: " . DBI->errstr;
my $sth = dbh->prepare('SELECT * FROM TAB')
or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute or die "Couldnt execute statement: " . $sth->errstr;
$dbh->disconnect;
When I executed the above piece of code I got the following error:
Can't locate object method "prepare" via package "dbh" at ./fpgm2db line 9.
The PATH, LD_LIBRARY_PATH, TWO_TASK, ORACLE_HOME env variabes are set to proper
values. Could this problem be because, although my Oralce Home points to 7.3.4, I am
using
8.0.5's lib directory(for LD_LIBRARY_PATH). But I did that, because I get an error if
I try to use
7.3.4's lib.
Need your help, to get started in the DBI World :-)
Thanks in advance,
Ajay
Versions:
DBI - 1.15
DBD - 1.06
Perl - 5.004_04
OS - Sun OS 5.6