What Tommy and Chris said. :})
Let the Perl interpreter do some of the syntax checking for you. You should
have -w in the #! line and 'use strict;' (without the quotes) near the top
of your file.
It's easier to use $DBI::errstr to get the error message. It always
contains the error string from the most recently used DBI handle. $dbh ->
{RaiseError} is also worth a look.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
----- Original Message -----
From: "Ajay Madan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 29, 2001 06:32
Subject: Can't locate object method "prepare" via package "dbh" - Error
> 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.