In a previous life, I worked on a portal-type enterprise application in
which a single deployment supported multiple customers.  For each
deployment, there was a master database, and n customer databases, one per
customer.  The general mechanism we used there was to put the connection
pool connections to the master database (catalog), and then do a
connection.setCatalog() for the customer-specific data.  This of course
means that you have a single DB server which hosts the master + n customer
DBs.

So, that's one approach that works in a production world.

To modify the datasources on the fly would require (I think) your own
context / JNDI provider (rather then Tomcat's) which maintained the list of
available DataSources.

Tim

-----Original Message-----
From: Warrick Wilson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 20, 2006 3:52 PM
To: users@tomcat.apache.org
Subject: Setting up connection pools "on the fly"...

I've got a project where there's a basic interface, with some basic 
database access. However, when someone "signs up", then a new MySQL 
database will be allocated for them. There's security associated with 
it, and the user will have to log in to identify himself. 

How can I create a new connection pool for that new database for my 
web app? My current pool is set up in context.xml - do I modify that 
on the fly from my web app?

What I'm doing currently is figuring out who the user is and which 
database he's associated with, and when I do any database work, the 
first statement is "USE <databasename>" to get the proper database.

Is there a better approach? More like a proper approach? (Says he who 
isn't sure he fully understands connection pools yet....)

-- 
Warrick Wilson
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to