Re: how to use Apache::DBI

2007-08-01 Thread Ken Perl
ok, I'll try connect_cached too. On 8/1/07, Perrin Harkins <[EMAIL PROTECTED]> wrote: > On 7/31/07, Clinton Gormley <[EMAIL PROTECTED]> wrote: > > What you could do instead is to use DBI's connect_cached method, which > > provides similar functionality. I actually use this instead of > > Apache::

Re: how to use Apache::DBI

2007-08-01 Thread Ken Perl
it is really good gotchas and should be included to the ModPerl::Registry document. thanks a lot. On 7/31/07, Clinton Gormley <[EMAIL PROTECTED]> wrote: > On Tue, 2007-07-31 at 10:09 +0800, Ken Perl wrote: > > I didn't run it under ModPerl::Registry, is there any risk to use the > > module? maybe

Re: how to use Apache::DBI

2007-07-31 Thread Perrin Harkins
On 7/31/07, Clinton Gormley <[EMAIL PROTECTED]> wrote: > What you could do instead is to use DBI's connect_cached method, which > provides similar functionality. I actually use this instead of > Apache::DBI, even when running under mod_perl. I also use connect_cached in many cases. Just be aware

Re: how to use Apache::DBI

2007-07-31 Thread Clinton Gormley
On Tue, 2007-07-31 at 10:09 +0800, Ken Perl wrote: > I didn't run it under ModPerl::Registry, is there any risk to use the > module? maybe I have to run lots of testing to the existing scripts. > There is a risk to using this module, but also a significant benefit: speed. The risks come from:

Re: how to use Apache::DBI

2007-07-31 Thread Clinton Gormley
On Tue, 2007-07-31 at 14:36 +0800, Ken Perl wrote: > OK, got it. Is it possible to use the same db connections in one > request? if yes, could you please show me how to implement this if a > cgi script calls many times other perl modules which requests db > connections to work. > Yes it is, alth

Re: how to use Apache::DBI

2007-07-30 Thread Ken Perl
OK, got it. Is it possible to use the same db connections in one request? if yes, could you please show me how to implement this if a cgi script calls many times other perl modules which requests db connections to work. On 7/31/07, Perrin Harkins <[EMAIL PROTECTED]> wrote: > On 7/30/07, Ken Perl <

Re: how to use Apache::DBI

2007-07-30 Thread Perrin Harkins
On 7/30/07, Dodger <[EMAIL PROTECTED]> wrote: > You're being semantically picky with this guy, and innacurately so. > An apache registry script *is* a CGI script. So is an ASP page, a PHP > script, and any other interpreted way fo dealing with CGI input. We tend to be generous with the use of the

Re: how to use Apache::DBI

2007-07-30 Thread Dodger
Clinton Gormley wrote: On Mon, 2007-07-30 at 18:21 +0800, Ken Perl wrote: I've configured the Apache::DBI in httpd.conf like this, PerlModule Apache::DBI I didn't have Apache::DBI->connect_on_init($data_source, $username, $auth, \%attr) in startup.pl since we don't use startup.pl. and the

Re: how to use Apache::DBI

2007-07-30 Thread Perrin Harkins
On 7/30/07, Ken Perl <[EMAIL PROTECTED]> wrote: > I didn't run it under ModPerl::Registry Did you run it under some other mod_perl module, like ModPerl::PerlRun? If it's a CGI script, and you aren't running it through something like this, then you aren't running it through mod_perl and you won't

Re: how to use Apache::DBI

2007-07-30 Thread Ken Perl
I didn't run it under ModPerl::Registry, is there any risk to use the module? maybe I have to run lots of testing to the existing scripts. Could I just run use the previous connections via DBI->connect_cache instead of the Apache::DBI in one single cgi script(but the script will call other modules

Re: how to use Apache::DBI

2007-07-30 Thread Perrin Harkins
On 7/30/07, Ken Perl <[EMAIL PROTECTED]> wrote: > my question is I can not find any persistent connections for my CGI > script. If you are running your scripts through ModPerl::Registry, all you need to do is call DBI->connect normally and you will get persistent connections. - Perrin

Re: how to use Apache::DBI

2007-07-30 Thread Clinton Gormley
On Mon, 2007-07-30 at 18:21 +0800, Ken Perl wrote: > I've configured the Apache::DBI in httpd.conf like this, > > PerlModule Apache::DBI > > I didn't have Apache::DBI->connect_on_init($data_source, $username, > $auth, \%attr) in startup.pl since we don't use startup.pl. and the > doc says to co

Re: how to use Apache::DBI

2007-07-30 Thread Arshavir Grigorian
connect_on_init() creates the database connection when the Apache child process starts (vs when it serves the first request). This ensures that the first request gets to use an existing connection vs having to wait for a connection to be made. Also to benefit from Apache::DBI functionality your sc