Re: Apache::DBI connect_on_init problem

Jiri Pavlovsky <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 17.4.2010 22:22, Chris Bennett wrote:
> On 04/17/10 14:27, Jiri Pavlovsky wrote:
>> Hello,
>>
>> I'm trying to prestart db connection. But Apache::DBI->connect_on_init
>> is not working. Gives no error, but db connection is not made.
>> Setting $Apache::DBI::DEBUG = 2 indicates that ChildInitHandler runs.
>>
>> I tried to create my custom ChildInitHandler and start db connection
>> from it but it also has no effect.
>> It also seems as if the handler was silently aborted after the connect
>> call.
>> I inserted debugging print before and after the connect call. In the
>> Postgres log I can see a connection made and immediately terminated.
>>
>>
>> So now I'm quite helpless as what to do.
>>
>
> I use Apache::DBI and connect_on_init.
> What are your full details? Using startup.pl?
> what values for initial connection?



Hello,

my start-up.pl below. I try to setup two connections.

In Apache log I see several lines like:
13121 Apache::DBI             PerlChildInitHandler
13121 Apache::DBI             push PerlChildExitHandler

No errors. But in Postgres log I can see several very short connections 
as the first user. So maybe it is connecting and then it quits?

Thats all I could find out.

Thanks



----------------------------------------------



#!/usr/bin/perl -w



use strict;
use Apache::DBI;

$Apache::DBI::DEBUG = 2;

DBI->install_driver("Pg");




   Apache::DBI->connect_on_init("dbi:Pg:dbname=p69",
     "user",
     "pass",
     {
       PrintError => 1, # warn() on errors
       RaiseError => 0, # don't die on error
       AutoCommit => 1, # commit executes immediately
       pg_enable_utf8 => 1,
     }
   );

   Apache::DBI->connect_on_init("dbi:Pg:dbname=p69",
     "another",
     "pass",
     {
       PrintError => 1, # warn() on errors
       RaiseError => 0, # don't die on error
       AutoCommit => 1, # commit executes immediately
       pg_enable_utf8 => 1,
     }
   );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.