try using

DBI->trace(2,"/tmp/dbitrace.log");
$Apache::DBI::DEBUG = 2;

in your startup script...

Apache::DBI will only reuse $dbh handles when the connect string matches
exactly, including all the various options, so make sure your
Apache::DBI->connect_on_init and script DBI->connect strings match.

HTH

--Geoff


> -----Original Message-----
> From: vinecent hong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 27, 2000 8:22 AM
> To: [EMAIL PROTECTED]
> Subject: help me under those Apache::DBI log info.
> 
> 
> Hello,
> 
> while I begin to  write some test perl script to test 
> mod_perl after  read
> necessary document,still get folloing error.please correct my 
> error(maybe
> silly one)
> 
> Following is my problem while using mod_perl.
> apache 1.3.3 + mysql 2.22 + RH  6.0 + modperl 1.21 + perl 5.005_3
> Modperl build w/ everything=1
> apache conf:
> 
> Alias /perl/            /usr/local/apache/share/cgi-bin/
> PerlFreshRestart        On
> PerlRequire             
> /usr/local/apache/share/cgi-bin/include/startup.pl
> #PerlSetupEnv OFF
> PerlSendHeader OFF
> #DBI_TRACE "2=/tmp/dbitrace.log"
> PerlModule Apache::DBI
> 
> <Location /perl>
> SetHandler  perl-script
> PerlHandler Apache::Registry
> # PerlSendHeader On
> Options +ExecCGI
> </Location>
> 
> <Location /perl-status>
> SetHandler  perl-script
> PerlHandler Apache::Status
> </Location>
> +++++++++++++
> 
> and the startup.pl is below:
> use CGI;
> use Apache::DBI;
> use strict;
> Apache::DBI->connect_on_init
> ("DBI:mysql:uwang::localhost",
> "uwang",
> "uwang",
> {
> PrintError => 1, # warn() on errors
> RaiseError => 0, # don't die on error
> AutoCommit => 1 # commit executes immediately
> }
> );
> 1;
> ++++++++++++++++++++
> I did read the mod_perl,cgi-to_mod_perl,mod_perl_traps and
> perl.apche.org/guide before coding.
> 
> now weird problem is:
> 1. since I use connect_on_init and set dbi trace,I think once 
> the apache
> server start,it should automatically create a dbh 
> connection,aka dbh,is it?
> but i never see this info in /tmp/dbitrace.log  .why?
> 
> 2.dbitrace.log did log any connection  made by my mod_perl 
> script.something
> like below:
> DBI 1.06 dispatch trace level set to 2
> -> DBI->Apache::DBI::connect(DBI:mysql:uwang::localhost, uwang, uwang,
> HASH(0x830d900))
> <- FETCH= 'mysql' ('Name' from cache) at DBI.pm line 64.
> -> ping for DBD::mysql::db (Apache::DBI::db=HASH(0x821db30)~0x821db00)
> <- ping= 1 at DBI.pm line 112.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> -> STORE for DBD::mysql::db (DBI::db=HASH(0x821db00)~INNER 
> 'RaiseError' 0)
> <- STORE= 1 at DBI.pm line 400.
> -> STORE for DBD::mysql::db (DBI::db=HASH(0x821db00)~INNER 
> 'PrintError' 1)
> <- STORE= 1 at DBI.pm line 400.
> -> STORE for DBD::mysql::db (DBI::db=HASH(0x821db00)~INNER 
> 'AutoCommit' 1)
> <- STORE= 1 at DBI.pm line 400.
> <- connect= Apache::DBI::db=HASH(0x821db30)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Now here is 2 questoin. first is,does the ping=1... line 
> means what the
> guide document said "it will ping if a exist dbh still   
> alive" ?so does the
> ping=1 means "Yes,I've find a exist dbh and it's ok"?since 
> these info is
> generate by my first connection in my script,does it means 
> it's ping the dbh
> create by the apache::DBI connect_on_init?butjust the 
> connect_on_init not
> logged? the 2nd is,the connect line, does this means,"ok,I 
> will tell  the
> mod_perl script to use a exist dbh HASH(0x821db30)"?  if 
> so,means the script
> is REUSE the dbh as we expect.Also,I am  quite sure  because 
> when I reload
> the script again and find out that above log info  occur 
> again,yeah,so does
> it means the 2nd connection still reuse the same dbh?
> I am happy at first but later all changed. TO test if its 
> true,I use ab to
> do the test,I run with:
> ./httpd -X
> then
> ./ab -n 10 -c 10 myscript.pl
> 
> during the runtime,I use mysaladmin processlist to see it it 
> REALLY just
> create one connection.and :-----( NO,NOT at all.tens of mysql 
> connection
> there...why? Do I understand above log info  wrongly or config the
> httpd.conf file wrong?
> 
> ______________________________________________
> FREE Personalized Email at Mail.com
> Sign up at http://www.mail.com?sr=mc.mk.mcm.tag001
> 

Reply via email to