Does each connection in the pool corresponds to an Oracle user's session? It seems no. I've configured a pool of 50 connections in my datasource in WAS and run my web application which use the above DS to connect to Database but when I open the Oracle Enterprise manager console there's only one session for the user from the WAS machine. BTW, when I killed that session in Oracle, my webapp can run without throwing SQLException. It seems the pool automatically create another session to Oracle to replace the killed one. What do you think about this. It seems I do not have a good understanding of connection pooling. Hope you can explain. Thanks
SCJP 1.4, SCWCD
Joined: Jul 27, 2002
Hi Giang, Let me just speculate that 50 connections is the pool's maximum size. Normally it will open connections as they are needed, though there are also pools that open the minimum number of connections for starters. If you do not do a lot of database access, one open connection will easily suffice. Why would the pool open more? After all, its rationale is to limit the number of open connections. This is of course all speculation, but grounded in a basic understanding of what the pool does. In order to give a detailed account, we 'd need to know what pool you are using and how exactly you configured it. The pool establishing a new connection seems just expected behaviour to me: either it re-established the invalid connection you killed, or it opened a new one (from the pool's perspective, from a DB perspective it 's always a new connection). Good, that 's what the pool is there for. Good riding, Rudy.
As Rudy pointed out, the connection is not tied to the user's session. Unless two users are hitting the application simulaneously, they can share a connection. Also note that one use can never need more than one connection at a time (unless you have threads.)