I have a little more data. I don't think its the database handler that is giving me trouble. I think its the statement handler. As some other queries work in the same module before I get to the statement handler that is breaking.
Should I be making new statement handlers for every new request? Doesn't
seem right.
---------------------------- Original Message ----------------------------
Subject: DBI : Is this the right way to do it?...
From: "Levon Barker" <[EMAIL PROTECTED]>
Date: Thu, October 23, 2003 12:49
To: [EMAIL PROTECTED]
--------------------------------------------------------------------------
Hello,
(my last message got cut off)
Can someone verify that this is the right way to use DBI and mod_perl (with
Apache::DBI of course). I get problems where if the user cancels a request
before my module has finished accessing my Oracle db, the module does not
work for any ongoing requests until I restart the Apache server. This is not
real code but an example of how I am putting it all together.
################ START OF CODE SNIPPET ###########
package SomeModuleWhichShowsUpAsaAPage;
my $dbh = DBI->connect ( 'dbi:Oracle:paprodi','test', 'test',
{
RaiseError => 1,
AutoCommit => 0
}
) || die "Oracle database connection not made";
my $sql = "select title from industry where id = ?";
my $sth = $dbh->prepare($industrySql);
sub handler {
my $r = shift;
my $id = $r->param('id');
$r->send_http_header('text/html');
print &get_industry_str($id);
return OK;
}
sub get_industry_str {
my $id = shift;
$sth->execute($id);
my $title;
$sth->bind_col( 1, \$title);
$while ($sth->fetch) {
}
return $title;
}
#################### END OF CODE SNIPPET ##################
When a user does cancel the request before the db access has finished, I get
this in my error log the next time a user tries to call the page:
ORA-03113: end-of-file on communication channel
I am worried I havn't got my head arround the shared database handler
concept. Any help would be appreciated.
Thanks,
Levon Barker
Levon Barker
Portfolio Aid
416-413-4053
<<attachment: winmail.dat>>
