[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: Apache::DBI Wisdom Sought
From:       Chris Winters <cwinters () intes ! net>
Date:       2000-08-31 15:31:07
[Download RAW message or body]

* Mark D Wolinski (mark@mrmark.com) [000831 11:24]:
> Hi all,
> 
> You'll pardon me a little, I hope for this message does tend to lap over out
> of ModPerl, but if it'll make you feel at ease,  I shall only expect wisdom
> on the modperl side.
> 
> I run a service of free message boards where users can create their own
> message boards.  Currently and in the past, I have used BerkeleyDB to store
> everything.
> 
> I have decided to move towards mySQL and run under ModPerl.
> 
> My current plan is to have one DB which stores everyones settings, etc in
> tables.
> 
> Then I was going to create a database for each message board.
> 
> Under ModPerl, I was going to utilize Apache::DBI to create a persistent
> connection to the main DB.  However, how will this affect the connections
> being made to individual DBs?  I have a nagging feeling that they'll connect
> until mySQL reaches it's concurrent connection limit then stop being able to
> connect to service since it would be filled with persistent connections of
> the first 150 (or so) forums accessed.
> 
> Am I correct in my feelings on that?

You could always connect to the 'mysql' database in your connection
string, and then 'use' the database you'd like once you get the
connection back:

 my $dbh = DBI->connect( 'DBI:mysql:database=mysql', 'user', 'pass',
                         { RaiseError => 1 } )
               || die $DBI::errstr;
 $dbh->do( "use $the_proper_database" );

 ... continue ...

I use this all the time, no problems. 

Chris

-- 
Chris Winters
Senior Internet Developer    intes.net
cwinters@intes.net           http://www.intes.net/
Integrated hardware/software solutions to make the Internet work for you.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic