Andrew Laughlin wrote:
Notice no username or password entry exists. Here's the code to get a
connection:
Context ctx = new InitialContext();
org.apache.tomcat.dbcp.dbcp.BasicDataSource ds =
(org.apache.tomcat.dbcp.dbcp.BasicDataSource)ctx.lookup(
"java:comp/env/jdbc/DB" );
// These must be set before the call to getConnection(), since getConnection
actually creates the pool.
ds.setDefaultCatalog( orgID );
ds.setUsername( orgID );
ds.setPassword( orgID );
So let's try to run this code:
1. user A performs request, pool is empty, so it's initialized with
credentials of user A
2. user B performs request, pool is already initialized, user B gets
connection created with credentials of user A
3. user A releases connection, it goes back to the pool
4. user C performs, request, gets previously released connection
I don't think you like this scenario..
Idea is simple: create one pool for database.
--
Mikolaj Rydzewski <m...@ceti.pl>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org