That's completely easy you simple load Apache::DBI when the server starts see the Apache::DBI docu. The rest of your code stays as is.
http://search.cpan.org/dist/Apache-DBI-1.01/lib/Apache/DBI.pm Tom philge philip schrieb: > am very new to mod perl, actually we were just using use DBI modules and > al in our script.i think we have use Apache::DBI and al.do you have any > tutorial for writing scripts to make database connections with modperl.i > will go through it and change my scripts and then mail you.i hope you > are not disturbed with me. > > sincerely > > */Tom Schindl <[EMAIL PROTECTED]>/* wrote: > > You need to find out what's taking long: > > - Connection 2 database > - Use Apache::DBI => Connection cached > > - Query > - Use Apache::DBI+prepare_cached > > - Use Prepared Queries with Placeholders > > - Tune MySQL-indices maybe you need FULLTEXT-Indices > which are only available in MyISAM-Tables > http://dev.mysql.com/doc/refman/5.0/en/create-table.html > > - Tune MySQLs query cache > > - large scripts (mod_perl as you already did :-) > > I'd say that you should insert tracing calls and see what is slow. > > From your report it seems that the connection/query takes long and not > your perl-programm. > > Tom > > philge philip schrieb: > > thanks a lot for your reply.we understood everything is fine in our > > server.we are able to run the script u gave.we are developing a > database > > and our aim is to improve the speed of the cgi scripts fthat > > retreive data from our mysql database.we redirected out query to > scripts > > we copied to /perl directory but we are taking the same 13 seconds to > > retrive the data from our database.its a text based search..can > you give > > your opinion on this.is there any tutorial we can follow to > improve our > > scripts.please help us when you are free. > > > > Sincerely > > Philge > > > > */Tom Schindl /* wrote: > > > > It seems you are using old documentations: > > philge philip schrieb: > > > Following are the scripts I tried to run.For the first script I > > got the result and it shows mod_perl is installed and running but in > > the second script am unable to load the apache module.I have also > > attached the part of the my .conf file.please help me… > > > > > > *Program 1:* > > > > > > print "Content-type: text/plain\n\n"; > > > > > > print "Server's environment\n"; > > > > > > foreach ( keys %ENV ) > > > > > > { > > > > > > print > > > "$_\t$ENV{$_}\n"; > > > > > > } > > > > > > ** > > > *Result:* > > > Server's environment > > > > [snipp] > > > > > MOD_PERL mod_perl/2.0.2 > > > > > > > Perfect. > > > > > > > > > > > *Program 2:* > > > > > > use Data::Dumper; > > > my $r = Apache->request( ); > > > $r->send_http_header('text/plain'); > > > print Dumper(\%ENV); > > > > > > *Internal server error:* > > > Can't locate object method "request" via package "Apache" > (perhaps you > > > forgot to load "Apache"?) at mod_perl2.2.pl line 2. > > > > > > > > > > > > > That's simply wrong: > > > > ----------------8<---------------------- > > use Data::Dumper; > > use Apache::RequestUtil; > > use Apache::RequestRec; > > > > my $r = Apache2::RequestUtil->request; > > $r->content_type('text/plain'); > > print Dumper(\%ENV); > > ----------------8<---------------------- > > > > See: > > > > http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html > > or better if you are on prefork-mpm > > http://perl.apache.org/docs/2.0/api/ModPerl/RegistryPrefork.html > > > > > > > > Perl .conf file > > > > > > * * > > > * * > > > LoadModule perl_module modules/mod_perl.so > > > LoadModule apreq_module modules/mod_apreq2.so > > > > > > Alias /perl /var/www/perl > > > > > > > > > SetHandler perl-script > > > PerlResponseHandler ModPerl::Registry > > > PerlOptions +ParseHeaders > > > Options +ExecCGI > > > > > > > Correct. > > > > Tom > > > > > > > ------------------------------------------------------------------------ > > Yahoo! Music Unlimited - Access over 1 million songs. Try it free. > > >> > > > > ------------------------------------------------------------------------ > Groups are talking. We´re listening. Check out the handy changes to > Yahoo! Groups. > <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=41144/*http://groups.yahoo.com/local/newemail.html> >