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

List:       mysql-java
Subject:    Re: Multiple databases & pool
From:       "LEBLANC, CLAUDE" <claude.leblanc () bell ! ca>
Date:       2000-05-26 19:31:35
[Download RAW message or body]

I've just made some tests and I'm wondering if the database name is
important at all when we initialize a connection to mysql.

With the command prompt interface of mySQL, it is possible to do :
SELECT * FROM project1.table  or  SELECT * FROM project2.table
without preceeding the statement by "use projectx".

I tried the same thing in my test servlet : I connected once to "mysql"
database and then I made the following queries :
  select * from admin.project
  select * from project1.table
  select * from project2.table
...

So one pool of connections could be initialized to "mysql" as long
as the queries specify the database name in the FROM clause.

Does that make sense, or I'm missing something?
Many thanks to those who already reply my first mail.

Claude


> Subject: Multiple databases & pool
> 
> Hi,
> one topic that comes up once in a while in this mailing list is the use
> of a connection pool to avoid servlets from re-connecting to the
> database on every request.  The idea is to create a few connections to
> the database at initilisation and share those connections among
> requests.
> 
> But what happens if you have many databases to connect too.
> 
> In my case, I have data from project 1 in "project1" database, data from
> project 2 in "project2" database, and so on... Tables in each project
> are the same so I use the same servlets to query data from each database
> (once connected). The list of projects is listed in my "projects" table
> of "admin" database, which adds another database the user my select data
> from.
> 
> So the overall picture is that the user first connects to the admin
> database to select a project, make some queries in it, go back list from
> admin database, select another project, queries again.
> 
> I'd like to know your opinion on this kind of setup.  Do we forget the
> pool of connections when working with different databases at the same
> time?  Should I use a naming convention to have all my projects tables
> under one database?
> Any suggestions?
> 
> Thanks.
> Claude Leblanc

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread1218@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.

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

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