tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "micky none" <>
Subject Re: Re: Dynamic Connection
Date Wed, 26 Jan 2005 20:46:58 GMT
Thanks David,
I am already using the Datasource class to vreate a connection.For eg.
Context ctx = (Context) init.lookup("java:comp/env");
ds = (DataSource) ctx.lookup("jdbc/abc");
The problem is that to know which database is selected I am trying to do exactly what the
BasicDataSource class does,if that's possible.Is there any way by which I can read the environment
variables that TOMCAT has set....please help.

On Thu, 27 Jan 2005 David Smith wrote :
>Sounds like you can just about totally abandon the idea of using any pooling functions
provided by DBCP.  If I were designing, I'd construct an object that implements javax.sql.DataSource
and store it in the session as soon as you know what db is being used.  Then on each request,
get the DS from the session and use it as needed.  Just be sure you only store the DS in the
session -- don't store the connections.
>I'm sure there are other ideas out there as well.
>micky none wrote:
>>Hi Friends,
>>I want to dynamically configure the database,username and password settings,instead
of putting them in conf/server.xml.In other words,I dont know beforehand which database to
>>with which username and password.It all depends upon the person and the machine from
which it tries to make a connection.In yet another words,I just need to do what the BasicDataSource
is doing i.e get the connection details before making a connection.I am not quite sure if
you got my point,but this is what i've been asked to do and I have no clue as to where to
go or what to do.If anyone of you got my point,please help me.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message