I am writing a package for my own use at work.
In it there is a function that connects to an Oracle database, executes
a package procedure and then disconnects and returns a value.
When I call this from another script, I get
Issuing rollback() for database handle being DESTROY'd without explicit
disconne
ct()
Here is the package function:
sub getinstalledversion {
use DBI;
use OracleDB;
my $self = shift;
my $name = $self->getname();
my ($revision, $result);
my $qa = OracleDB::connect("qa", "userid", "password");
$name = uc($name);
my ($module, $path, $ext) = fileparse($name,'\..*');
my $csr = $qa->prepare(q{
BEGIN
:revision := pk_dbutil.get_version(:module);
END;
});
$csr->bind_param(":module", $module);
$csr->bind_param_inout(":revision", \$revision, 80);
$csr->execute;
$csr->finish();
$qa->disconnect();
$revision = Utilities::File::stripVersion($revision);
return $revision;
}
Here is the portion of the script that calls this function:
...
my $installed = $object->getinstalledversion();
print "Installed version is $installed\n";
...
The print statement executes with the value of $installed set. However,
I get
"Issuing rollback() for database handle being DESTROY'd without explicit
disconnect()..." right after the print statement.
Have I misunderstood the use of DBI in the context of a class in a
package?
I am using perl 5.005_03
on AIX Unix 4.3.3.0
and the version of the Oracle database is:
Oracle8i Enterprise Edition Release 8.1.7.2.0 - 64bit Production
JServer Release 8.1.7.2.0 - 64bit Production