Dynamic Connection

2005-01-26 Thread micky none
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 use, with which username and password.It all depends upon the person and the machine from which it tries to

Re: Dynamic Connection

2005-01-26 Thread David Smith
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

Re: Re: Dynamic Connection

2005-01-26 Thread micky none
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

Re: Dynamic Connection

2005-01-26 Thread David Smith
A JNDI lookup isn't the only way to get a DataSource. You can just call new on your favorite database's implementation of DataSource, set the appropriate attributes and cast it to javax.sql.DataSource for generic use. For instance: com.mysql.jdbc.DataSource mysqlDS = new