You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by I S <ci...@yahoo.com> on 2004/05/12 18:15:06 UTC

DBI and Apache::DBI

Hi all,

I have some questions with DBI. 

a) I don't understand why the database sometimes gets
dropped.  It happens randomly but frequently.

could not prepare: Database disconnected at
/dssweb/httpd/cgi-bin/feeds/viewReport line 157.


b) I built mod_perl and apache with EVERYTHING=1.  
Should I expect  DBI.pm appear in Apache directory?  
For some reason, it doesn't get there.  Or should I
add DBI module under Apached directory?  If so, how.  
I have my own version of Perl under home directory.

Thanks, 
Isarin  




	
		
__________________________________
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861 

-- 
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: DBI and Apache::DBI

Posted by "Erik Scholtz, ArgonSoft GmbH" <e....@argonsoft.de>.
I S wrote:

> Hi all,
> 
> I have some questions with DBI. 
> 
> a) I don't understand why the database sometimes gets
> dropped.  It happens randomly but frequently.
> 
> could not prepare: Database disconnected at
> /dssweb/httpd/cgi-bin/feeds/viewReport line 157.
> 
> 
> b) I built mod_perl and apache with EVERYTHING=1.  
> Should I expect  DBI.pm appear in Apache directory?  
> For some reason, it doesn't get there.  Or should I
> add DBI module under Apached directory?  If so, how.  
> I have my own version of Perl under home directory.
> 
> Thanks, 
> Isarin  
> 

Hello,

DBI.pm should normaly be in the tree of your perl-installation (where 
all global modules are stored). Your httpd.conf should contain the 
following lines in the config of your domain:

         LoadModule perl_module modules/mod_perl.so
         PerlModule Apache2
         PerlModule Apache::DBI

Perhaps it would be easier for us to help you, if you would include the 
necessary part of your script.



Erik

-----
ArgonSoft GmbH      | Im Ermlisgrund 3      | 76337 Waldbronn
Tel: +49 7243 71520 | Fax: +49 7243 715222  | http://www.argonsoft.de

-- 
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: DBI and Apache::DBI

Posted by I S <ci...@yahoo.com>.
Thanks, Guys,
 
I ended up installing Apache::DBI from CPAN and it is under /home/dssweb/local-perl/lib/site_perl/5.8.3.   I was mistaken that  Apache::DBI would come with apache.
Event though it was, for some reason it didn't get installed.
 
Anyways, it is working now.   
 
Cheers, Isarin 


Perrin Harkins <pe...@elem.com> wrote:
On Wed, 2004-05-12 at 14:32, I S wrote:
> Sorry for being unclear. I mean Apache subdirectory
> under site_perl directory. I can seee Registry.pm
> under .../site_perl/5.8.3/sun4-solaris/Apache
> directory. (Apache::Registry) I would expect DBI in
> the same directory but it is not there.

That's what I was saying: Apache::DBI is pure perl, so it doesn't go in
that directory. Look in /site_perl/5.8.3/Apache instead.

> I figured
> that out after it gave me an error that it can't find
> Apache::DBI.

If you have Apache::Registry installed, you should also have Apache::DBI
installed. Look for it with find or locate, and check the permissions
on the directories above it.

> b) Add DBI module and others 
> other modules such as LWP, HTTP are under:
> /home/dssweb/local-perl/lib/site_perl/5.8.3
> 
> yet my DBI module is under:
> /home/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris

Are you talking about DBI, not Apache::DBI? That's an XS module so it
goes into the architecture-dependent directory.

> My mod_perl and some Apache stuff are under 
> /home/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris

Then you should find Apache/DBI.pm under
/home/dssweb/local-perl/lib/site_perl/5.8.3.

- Perrin


-- 
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

		
---------------------------------
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2' 

Re: DBI and Apache::DBI

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-05-12 at 14:32, I S wrote:
> Sorry for being unclear.  I mean Apache subdirectory
> under site_perl directory.  I can seee Registry.pm
> under .../site_perl/5.8.3/sun4-solaris/Apache
> directory. (Apache::Registry)  I would expect DBI in
> the same directory but it is not there.

That's what I was saying: Apache::DBI is pure perl, so it doesn't go in
that directory.  Look in /site_perl/5.8.3/Apache instead.

> I figured
> that out after it gave me an error that it can't find
> Apache::DBI.

If you have Apache::Registry installed, you should also have Apache::DBI
installed.  Look for it with find or locate, and check the permissions
on the directories above it.

> b) Add DBI module and others 
>    other modules such as LWP, HTTP are under:
>       /home/dssweb/local-perl/lib/site_perl/5.8.3
>    
>    yet my DBI module is under:
> /home/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris

Are you talking about DBI, not Apache::DBI?  That's an XS module so it
goes into the architecture-dependent directory.

>     My mod_perl and some Apache stuff are under 
> /home/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris

Then you should find Apache/DBI.pm under
/home/dssweb/local-perl/lib/site_perl/5.8.3.

- Perrin


-- 
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: DBI and Apache::DBI

Posted by Brent 'Dax' Royal-Gordon <br...@brentdax.com>.
I S wrote:
> Sorry for being unclear.  I mean Apache subdirectory
> under site_perl directory.  I can seee Registry.pm
> under .../site_perl/5.8.3/sun4-solaris/Apache
> directory. (Apache::Registry)  I would expect DBI in
> the same directory but it is not there.   I figured
> that out after it gave me an error that it can't find
> Apache::DBI.

Try .../site_perl/Apache and .../site_perl/5.8.3/Apache.  Also, if you 
originally installed mod_perl with an older version of Perl, check its 
folders.

-- 
Brent "Dax" Royal-Gordon <br...@brentdax.com>
Perl and Parrot hacker

Oceania has always been at war with Eastasia.

-- 
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: DBI and Apache::DBI

Posted by I S <ci...@yahoo.com>.
> Apache::DBI comes with mod_perl, and you should see
> it in your site_perl directory.  It is a pure perl 
> module, so it would not be under an i386
> directory (or whatever your architecture is).  If
> you can do PerlModule Apache::DBI in your program 
> without failure, it means that it is there
> in your @INC path.

Sorry for being unclear.  I mean Apache subdirectory
under site_perl directory.  I can seee Registry.pm
under .../site_perl/5.8.3/sun4-solaris/Apache
directory. (Apache::Registry)  I would expect DBI in
the same directory but it is not there.   I figured
that out after it gave me an error that it can't find
Apache::DBI.

I am not sure what I missed when building mod_perl /
Apache.   Do I need to add environmental variables?


Let me recap what I did:

a) Build perl under my home directory
     /home/dssweb/local-perl 

b) Add DBI module and others 
   other modules such as LWP, HTTP are under:
      /home/dssweb/local-perl/lib/site_perl/5.8.3
   
   yet my DBI module is under:
/home/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris


c) Build mod_perl and apache.  

    My mod_perl and some Apache stuff are under 
/home/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris


Thanks.

     



	
		
__________________________________
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861 

-- 
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: DBI and Apache::DBI

Posted by Perrin Harkins <pe...@elem.com>.
[ Please keep it on the list... ]

On Fri, 2004-05-14 at 09:36, Alex McLintock wrote:
> sometimes at random my mod_perl/DBI/DBD::Mysql connections fail at 
> the execute stage resulting in an error something like "fetch failed 
> because of no execute" failure.
> 
> Does this sound like the same problem you are seeing. As far as I know 
> the prepare is working.... and I don't get the Database disconnected 
> message.

Do you have RaiseError turned on?  That message normally means you
missed a step or something failed earlier and you didn't notice.

- Perrin


-- 
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: DBI and Apache::DBI

Posted by MARTIN MOSS <ma...@btopenworld.com>.
You didn't specify which Database server you're using. If it's mysql you need to be cautious of the 'ping' method used by Apache::DBI to check if a connection is stale or not. the DBD::mysql ping method always returns a 'true' string e.g. "0 but true" rather than a 1 or a 0.
 
I believe the latest version of DBD::mysql has an automatic 'reconnect' feature, but We're still seeing failed connections occuring infrequently on our systems. (Still investigating).
 
Marty

Perrin Harkins <pe...@elem.com> wrote:
On Wed, 2004-05-12 at 12:15, I S wrote:
> a) I don't understand why the database sometimes gets
> dropped. It happens randomly but frequently.
> 
> could not prepare: Database disconnected at
> /dssweb/httpd/cgi-bin/feeds/viewReport line 157.

Usually this is caused by an inactivity timeout on your database
server. If you call DBI->connect before that, Apache::DBI will ping the
connection to make sure it is still live and re-connect if it isn't.

> b) I built mod_perl and apache with EVERYTHING=1. 
> Should I expect DBI.pm appear in Apache directory?

EVERYTHING=1 affects which hooks are enabled for mod_perl handlers. It
has nothing to do with which modules will be available.

Apache::DBI comes with mod_perl, and you should see it in your site_perl
directory. It is a pure perl module, so it would not be under an i386
directory (or whatever your architecture is). If you can do PerlModule
Apache::DBI in your program without failure, it means that it is there
in your @INC path.

- Perrin


-- 
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: DBI and Apache::DBI

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2004-05-12 at 12:15, I S wrote:
> a) I don't understand why the database sometimes gets
> dropped.  It happens randomly but frequently.
> 
> could not prepare: Database disconnected at
> /dssweb/httpd/cgi-bin/feeds/viewReport line 157.

Usually this is caused by an inactivity timeout on your database
server.  If you call DBI->connect before that, Apache::DBI will ping the
connection to make sure it is still live and re-connect if it isn't.

> b) I built mod_perl and apache with EVERYTHING=1.  
> Should I expect  DBI.pm appear in Apache directory?

EVERYTHING=1 affects which hooks are enabled for mod_perl handlers.  It
has nothing to do with which modules will be available.

Apache::DBI comes with mod_perl, and you should see it in your site_perl
directory.  It is a pure perl module, so it would not be under an i386
directory (or whatever your architecture is).  If you can do PerlModule
Apache::DBI in your program without failure, it means that it is there
in your @INC path.

- Perrin


-- 
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