It tells you that there is no method disconnect on the statement handle.

Because disconnect is done on the DB-Handle you have to use

$dbh->disconnect();

That does the trick.

+rl

"Condle, Joseph P" wrote:
> 
> The following is the output and the script I am trying to get working.
> I am new  to DBI.  I am running Perl 5.6.1 on Solaris 8 which I built
> from the source with gcc.  I have installed both DBI 1.21 and Oracle DBD
> 1.12.  I am running Oracle 8.1.7.  I got the following script from DBI
> examples @ http://www.saturn5.com/~jwb/dbi-examples.html.  The error is
> confusing to me because I did not get any errors when I installed DBI
> and DBD.
> 
> Joe
> 
> 123456789, Joe, Hanks, Pgh
> Can't locate object method "disconnect" via package "DBI::st" (perhaps
> you forgot to load "DBI::st"? at q2.pl line 31.
> Issuing rollback() for database handle being DESTROY'd without explicit
> disconnect().
> 
> #!/usr/bin/perl -w
> #
> use strict;
> use DBI;
> my $dbh = DBI->connect ( 'dbi:Oracle:SID',
>                         'xxxxxx',
>                         'xxxxxx',
>                         {
>                           RaiseError => 1,
>                           AutoCommit => 0
>                         }
>                        ) || "Database connection not made
> :$DBI::errstr";
> 
> my $sql = qq{ select ssn, fname, lname, city  from employee };
> my $sth = $dbh->prepare( $sql );
> $sth->execute();
> 
> my( $ssn, $fname, $lname, $city);
> $sth->bind_columns (undef, \$ssn, \$fname, \$lname, \$city);
> 
> while ( $sth->fetch() )
> {
>   print "$ssn, $fname, $lname, $city\n";
> }
> 
> $sth->finish();
> $sth->disconnect();

Reply via email to