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
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
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
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