Re: Database handle destroyed.....

2004-05-08 Thread Stas Bekman
Mark A. Downing wrote:
On Fri, 7 May 2004, Stas Bekman wrote:


Ah, now I understand. Thanks. Which version Mark is using?


I'm running 1.99_12. _13 didn't work for me. I too struggled with Apache::DBI.
If there is something I can do to help, please let me know.
What didn't work?

You can see the list of Changes here:
http://search.cpan.org/src/STAS/mod_perl-1.99_13/Changes
I'm not sure which particular change broke Apache::DBI. If someone could 
contribute a test against pure perl DBD and Apache::DBI that will ensure that 
Apache::DBI keeps on working as things evolve.

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Database handle destroyed.....

2004-05-07 Thread Mark A. Downing
On Fri, 7 May 2004, Stas Bekman wrote:

> Ah, now I understand. Thanks. Which version Mark is using?

I'm running 1.99_12. _13 didn't work for me. I too struggled with Apache::DBI.
If there is something I can do to help, please let me know.

I am a little late to the party, so I'm not sure of what your problem really
is. I caught the post about porting, so I thought I would enter the fray.

--Mark

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Database handle destroyed.....

2004-05-07 Thread Stas Bekman
Hulya Gurer wrote:
Since everything was working on old versions I wanted to lower the 
mod_perl to 08,
but I can't anyway, so I am not lowering the mod_perl, but Mark's patch 
didn't work,
we tried it and still get the same thing.
Ah, now I understand. Thanks. Which version Mark is using?

At 04:03 PM 5/7/2004, Stas Bekman wrote:

Hulya Gurer wrote:

Mark, thanks for the code.  I am not sure why but it didn't work for 
us.  It could be
the versions of everything we are on now.
Unfortunately I can not lower the version of mod_perl-1.99.13 to .08 ,


Hulya, why do you need to downgrade to .08? Have you actually tried to 
patch Apache::DBI with the patch Mark has posted? I'm not following 
you here.
--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Database handle destroyed.....

2004-05-07 Thread Hulya Gurer
Since everything was working on old versions I wanted to lower the mod_perl 
to 08,
but I can't anyway, so I am not lowering the mod_perl, but Mark's patch 
didn't work,
we tried it and still get the same thing.

H.

At 04:03 PM 5/7/2004, Stas Bekman wrote:
Hulya Gurer wrote:
Mark, thanks for the code.  I am not sure why but it didn't work for 
us.  It could be
the versions of everything we are on now.
Unfortunately I can not lower the version of mod_perl-1.99.13 to .08 ,
Hulya, why do you need to downgrade to .08? Have you actually tried to 
patch Apache::DBI with the patch Mark has posted? I'm not following you here.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Database handle destroyed.....

2004-05-07 Thread Stas Bekman
Hulya Gurer wrote:
Mark, thanks for the code.  I am not sure why but it didn't work for 
us.  It could be
the versions of everything we are on now.

Unfortunately I can not lower the version of mod_perl-1.99.13 to .08 , 
Hulya, why do you need to downgrade to .08? Have you actually tried to patch 
Apache::DBI with the patch Mark has posted? I'm not following you here.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Database handle destroyed.....

2004-05-07 Thread Hulya Gurer
Mark, thanks for the code.  I am not sure why but it didn't work for 
us.  It could be
the versions of everything we are on now.

Unfortunately I can not lower the version of mod_perl-1.99.13 to .08 , 
because it conflicts
with any version of Apache with Perl 5.8.3 and the apache does not get 
started at all.  Hoping that
we will get the new version of Apache-DBI next week to solve this problem, 
we will try to
leave with it for couple of days.

Thanks
Hulya
At 09:31 AM 5/7/2004, Mark A. Downing wrote:
On Fri, 7 May 2004, Frank Wiles wrote:

>   Well the source leads me to believe they already know it doesn't work
>   with mp2.  To quote it "TODO - Should check for mod_perl 2 and do
>   the right thing there".
I made some changes to make Apache-DBI work with mod_perl2 a few months ago.
It works great for me. I gave them to Ask, but nothing was apparently done
with it.
It's not elegant, but it works for me. Here is the diff:

--- DBI.pm  Tue Feb 17 16:18:50 2004
+++ DBI.pm.new  Thu Feb 26 14:52:49 2004
@@ -8,6 +8,7 @@
 use Carp qw(carp);
 require_version DBI 1.00;
+use constant MP2 => $mod_perl::VERSION >= 1.99;
 $Apache::DBI::VERSION = '0.94';

@@ -32,9 +33,14 @@
 # provide a handler which creates all connections during server startup
 # TODO - Should check for mod_perl 2 and do the right thing there
-carp "Apache.pm was not loaded\n" and return unless $INC{'Apache.pm'};
-if([EMAIL PROTECTED] and Apache->can('push_handlers')) {
-Apache->push_handlers(PerlChildInitHandler => \&childinit);
+if (MP2) {
+   Apache->server->push_handlers(PerlChildInitHandler => \&childinit);
+}
+else {
+   carp "Apache.pm was not loaded\n" and return unless $INC{'Apache.pm'};
+   if([EMAIL PROTECTED] and Apache->can('push_handlers')) {
+   Apache->push_handlers(PerlChildInitHandler => \&childinit);
+   }
 }
 # store connections
 push @ChildConnect, [EMAIL PROTECTED];
@@ -94,12 +100,23 @@
 # this PerlCleanupHandler is supposed to initiate a rollback after 
the script has finished if AutoCommit is off.
 my $needCleanup = ($Idx =~ /AutoCommit[^\d]+0/) ? 1 : 0;
 # TODO - Fix mod_perl 2.0 here
-if(!$Rollback{$Idx} and $needCleanup and Apache->can('push_handlers')) {
-print STDERR "$prefix push PerlCleanupHandler \n" if 
$Apache::DBI::DEBUG > 1;
-Apache->push_handlers("PerlCleanupHandler", \&cleanup);
-# make sure, that the rollback is called only once for every
-# request, even if the script calls connect more than once
-$Rollback{$Idx} = 1;
+if (MP2) {
+   if(!$Rollback{$Idx} and $needCleanup) {
+   print STDERR "$prefix push PerlCleanupHandler \n" if 
$Apache::DBI::DEBUG > 1;
+   Apache->server->push_handlers("PerlCleanupHandler", \&cleanup);
+   # make sure, that the rollback is called only once for every
+   # request, even if the script calls connect more than once
+   $Rollback{$Idx} = 1;
+}
+}
+else {
+   if(!$Rollback{$Idx} and $needCleanup and 
Apache->can('push_handlers')) {
+   print STDERR "$prefix push PerlCleanupHandler \n" if 
$Apache::DBI::DEBUG > 1;
+   Apache->push_handlers("PerlCleanupHandler", \&cleanup);
+   # make sure, that the rollback is called only once for every
+   # request, even if the script calls connect more than once
+   $Rollback{$Idx} = 1;
+   }
 }

 # do we need to ping the database ?

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Database handle destroyed.....

2004-05-07 Thread Frank Wiles
On Fri, 07 May 2004 09:49:13 -0700
Hulya Gurer <[EMAIL PROTECTED]> wrote:

> 
> Actually everything works with Perl 5.8.0 mod_perl 1.99.08 gcc 2.95.3 
> configuration,
> this error showed up after we upgraded one of our server to perl
> 5.8.3, mod_1.99.13, gcc.295.3
> 
> H.
> 
> 
> At 07:33 AM 5/7/2004, Frank Wiles wrote:
> >On Thu, 06 May 2004 19:00:46 -0700
> >Stas Bekman <[EMAIL PROTECTED]> wrote:
> >
> > > Hulya Gurer wrote:
> > > >
> > > > Sorry Stas, here it's.
> > > >
> > > > We are already using Apache::DBI->connect_on_init() and there
> > > > are not many accesses
> > > > to the database at this point that concern more than one
> > > > connection.
> > >
> > > As I suggested:
> > >
> > >  >> Apache::DBI doc doesn't claim to be ported to 2.0, it only
> > >  >suggests> that it may work or may not. I suppose that someone
> > >  >needs to port it.
> > >
> > > Anybody to port it? Shouldn't be too hard to do that. It'd be nice
> > > to equip it with a full Apache-Test based test suite, but that
> > > could be a next step.
> >
> >   Well the source leads me to believe they already know it doesn't
> >   work with mp2.  To quote it "TODO - Should check for mod_perl 2
> >   and do the right thing there".
> >
> >   I'll give it a go over the weekend and see if I can get it ported.
> >
> >   I'll probably need it for my current project once it goes
> >   production anyway.

  Yeah now that I read the change log it appears there have been several
  patches to add mp2 support.  If you're running the latest version
  0.94, I'm betting the problem is probably with an API change between
  1.99_08 and 1.99_13.  But that's just from taking a quick glance. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 -


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Database handle destroyed.....

2004-05-07 Thread Hulya Gurer


Actually everything works with Perl 5.8.0 mod_perl 1.99.08 gcc
2.95.3 configuration,
this error showed up after we upgraded one of our server to perl 5.8.3,
mod_1.99.13, gcc.295.3
H.

At 07:33 AM 5/7/2004, Frank Wiles wrote:
On Thu, 06 May 2004 19:00:46
-0700
Stas Bekman <[EMAIL PROTECTED]> wrote:
> Hulya Gurer wrote:
> > 
> > Sorry Stas, here it's.
> > 
> > We are already using Apache::DBI->connect_on_init() and
there are
> > not many accesses
> > to the database at this point that concern more than one
connection.
> 
> As I suggested:
> 
>  >> Apache::DBI doc doesn't claim to be ported to 2.0, it
only
>  >suggests> that it may work or may not. I suppose that
someone needs
>  >to port it.
> 
> Anybody to port it? Shouldn't be too hard to do that. It'd be nice
to
> equip it with a full Apache-Test based test suite, but that could be
a
> next step.
  Well the source leads me to believe they already know it doesn't
work
  with mp2.  To quote it "TODO - Should check for mod_perl
2 and do
  the right thing there".  
  I'll give it a go over the weekend and see if I can get it ported.

  I'll probably need it for my current project once it goes
production
  anyway. 
 -
   Frank Wiles <[EMAIL PROTECTED]>
  
http://frank.wiles.org
 -


Re: Database handle destroyed.....

2004-05-07 Thread Frank Wiles
On Fri, 7 May 2004 09:31:44 -0700 (PDT)
"Mark A. Downing" <[EMAIL PROTECTED]> wrote:

> On Fri, 7 May 2004, Frank Wiles wrote:
> 
> >   Well the source leads me to believe they already know it doesn't
> >   work with mp2.  To quote it "TODO - Should check for mod_perl 2
> >   and do the right thing there".
> 
> I made some changes to make Apache-DBI work with mod_perl2 a few
> months ago. It works great for me. I gave them to Ask, but nothing was
> apparently done with it.
> 
> It's not elegant, but it works for me. Here is the diff:

  Could be that he just hasn't had time to release a new version yet.

  Thanks for letting me know so I didn't waste my time this weekend! :) 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 -


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Database handle destroyed.....

2004-05-07 Thread Mark A. Downing
On Fri, 7 May 2004, Frank Wiles wrote:

>   Well the source leads me to believe they already know it doesn't work
>   with mp2.  To quote it "TODO - Should check for mod_perl 2 and do
>   the right thing there".

I made some changes to make Apache-DBI work with mod_perl2 a few months ago.
It works great for me. I gave them to Ask, but nothing was apparently done
with it.

It's not elegant, but it works for me. Here is the diff:


--- DBI.pm  Tue Feb 17 16:18:50 2004
+++ DBI.pm.new  Thu Feb 26 14:52:49 2004
@@ -8,6 +8,7 @@
 use Carp qw(carp);

 require_version DBI 1.00;
+use constant MP2 => $mod_perl::VERSION >= 1.99;

 $Apache::DBI::VERSION = '0.94';

@@ -32,9 +33,14 @@
 # provide a handler which creates all connections during server startup

 # TODO - Should check for mod_perl 2 and do the right thing there
-carp "Apache.pm was not loaded\n" and return unless $INC{'Apache.pm'};
-if([EMAIL PROTECTED] and Apache->can('push_handlers')) {
-Apache->push_handlers(PerlChildInitHandler => \&childinit);
+if (MP2) {
+   Apache->server->push_handlers(PerlChildInitHandler => \&childinit);
+}
+else {
+   carp "Apache.pm was not loaded\n" and return unless $INC{'Apache.pm'};
+   if([EMAIL PROTECTED] and Apache->can('push_handlers')) {
+   Apache->push_handlers(PerlChildInitHandler => \&childinit);
+   }
 }
 # store connections
 push @ChildConnect, [EMAIL PROTECTED];
@@ -94,12 +100,23 @@
 # this PerlCleanupHandler is supposed to initiate a rollback after the script has 
finished if AutoCommit is off.
 my $needCleanup = ($Idx =~ /AutoCommit[^\d]+0/) ? 1 : 0;
 # TODO - Fix mod_perl 2.0 here
-if(!$Rollback{$Idx} and $needCleanup and Apache->can('push_handlers')) {
-print STDERR "$prefix push PerlCleanupHandler \n" if $Apache::DBI::DEBUG > 1;
-Apache->push_handlers("PerlCleanupHandler", \&cleanup);
-# make sure, that the rollback is called only once for every
-# request, even if the script calls connect more than once
-$Rollback{$Idx} = 1;
+if (MP2) {
+   if(!$Rollback{$Idx} and $needCleanup) {
+   print STDERR "$prefix push PerlCleanupHandler \n" if $Apache::DBI::DEBUG > 
1;
+   Apache->server->push_handlers("PerlCleanupHandler", \&cleanup);
+   # make sure, that the rollback is called only once for every
+   # request, even if the script calls connect more than once
+   $Rollback{$Idx} = 1;
+}
+}
+else {
+   if(!$Rollback{$Idx} and $needCleanup and Apache->can('push_handlers')) {
+   print STDERR "$prefix push PerlCleanupHandler \n" if $Apache::DBI::DEBUG > 
1;
+   Apache->push_handlers("PerlCleanupHandler", \&cleanup);
+   # make sure, that the rollback is called only once for every
+   # request, even if the script calls connect more than once
+   $Rollback{$Idx} = 1;
+   }
 }

 # do we need to ping the database ?

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Database handle destroyed.....

2004-05-07 Thread Frank Wiles
On Thu, 06 May 2004 19:00:46 -0700
Stas Bekman <[EMAIL PROTECTED]> wrote:

> Hulya Gurer wrote:
> > 
> > Sorry Stas, here it's.
> > 
> > We are already using Apache::DBI->connect_on_init() and there are
> > not many accesses
> > to the database at this point that concern more than one connection.
> 
> As I suggested:
> 
>  >> Apache::DBI doc doesn't claim to be ported to 2.0, it only
>  >suggests> that it may work or may not. I suppose that someone needs
>  >to port it.
> 
> Anybody to port it? Shouldn't be too hard to do that. It'd be nice to
> equip it with a full Apache-Test based test suite, but that could be a
> next step.

  Well the source leads me to believe they already know it doesn't work
  with mp2.  To quote it "TODO - Should check for mod_perl 2 and do
  the right thing there".  

  I'll give it a go over the weekend and see if I can get it ported. 

  I'll probably need it for my current project once it goes production
  anyway. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 -


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Database handle destroyed.....

2004-05-06 Thread Stas Bekman
Hulya Gurer wrote:
Sorry Stas, here it's.
We are already using Apache::DBI->connect_on_init() and there are not 
many accesses
to the database at this point that concern more than one connection.
As I suggested:
>> Apache::DBI doc doesn't claim to be ported to 2.0, it only suggests
>> that it may work or may not. I suppose that someone needs to port it.
Anybody to port it? Shouldn't be too hard to do that. It'd be nice to equip it 
with a full Apache-Test based test suite, but that could be a next step.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Database handle destroyed.....

2004-05-06 Thread Hulya Gurer


Sorry Stas, here it's.
We are already using
Apache::DBI->connect_on_init() and
there are not many accesses 
to the database at this point that concern more than one
connection.
My startup.pl has 
use Apache::DBI ();
use DBI ();
Apache::DBI->connect_on_init("DBI:DB2:supwbdev",
"wkbtest", "proton", {RaiseError => 0, AutoCommit
=> 1});
Apache::DBI->connect_on_init("DBI:DB2:supwb",
"wkbench", "electron", {RaiseError => 0,
AutoCommit => 1});
Apache::DBI->connect_on_init("DBI:DB2:custwbdv",
"custwbdv", "skunk18", {RaiseError => 0,
AutoCommit => 1});
Apache::DBI->connect_on_init("DBI:DB2:custwb",
"custwb", "ferret72", {RaiseError => 0, AutoCommit
=> 1});
#-
# For BAP test - 5/8/03
Apache::DBI->connect_on_init("DBI:DB2:EPRODUCT",
"db2inst1", "abc123", {RaiseError => 0, AutoCommit
=> 1});
Apache::DBI->connect_on_init("DBI:DB2:PROD_DEV",
"ebtest", "gopher88", {RaiseError => 0, AutoCommit
=> 1});
Thanks,
Hulya


At 05:31 PM 5/6/2004, Stas Bekman wrote:
Hulya Gurer wrote:
Hello,
I have a new Solaris server that runs on Solaris 8 and has been upgraded
to Perl 5.8.3, Apache 2.49,
mod_perl 1.99.13, and DB2 running as Database.  When I start the
apache server with startup.pl I get,
Database handle destroyed without explicit disconnect at
/usr/local/lib/perl5/site_perl/5.8.3/Apache/DBI.pm line 146
error. I have searched on this a little bit and there are several
different approaches from mod_perl to module versions.

Looks like the old issue of opening the connection in the parent
process:
http://perl.apache.org/docs/1.0/guide/databases.html#Skipping_connection_cache_during_server_startup
Apache::DBI doc doesn't claim to be ported to 2.0, it only suggests that
it may work or may not. I suppose that someone needs to port 
it.
-- 
__
Stas
Bekman   
JAm_pH --> Just Another mod_perl Hacker
http://stason.org/   
 mod_perl Guide --->
http://perl.apache.org
mailto:[EMAIL PROTECTED]
http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Database handle destroyed.....

2004-05-06 Thread Stas Bekman
Hulya Gurer wrote:
Hello,
I have a new Solaris server that runs on Solaris 8 and has been upgraded 
to Perl 5.8.3, Apache 2.49,
mod_perl 1.99.13, and DB2 running as Database.  When I start the apache 
server with startup.pl I get,

Database handle destroyed without explicit disconnect at 
/usr/local/lib/perl5/site_perl/5.8.3/Apache/DBI.pm line 146

error. I have searched on this a little bit and there are several 
different approaches from mod_perl to module versions.

Looks like the old issue of opening the connection in the parent process:
http://perl.apache.org/docs/1.0/guide/databases.html#Skipping_connection_cache_during_server_startup
Apache::DBI doc doesn't claim to be ported to 2.0, it only suggests that it 
may work or may not. I suppose that someone needs to port it.

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html