-
1. Re: How to exploit prepared statements
armint Jan 28, 2002 12:03 PM (in response to cjohan)Most likely not closing the db connection will be bad. Every instance, even pooled ones without identities, is going to have an open connection. If you only have a few entities instantiated at a time, it's not much of a problem. However, for n number of entity beans you will have n connections and n statements open. Also, most of the time those connections will be idle, just taking up resources.
In my experience, creating prepared statements is not much of a performance problem. -
2. Re: How to exploit prepared statements
kashpaw Jan 28, 2002 5:32 PM (in response to cjohan)The pool maintains a cache of the prepared statements ready for reuse, along with open connections. When you call close on the pooled connection it is just returned to the pool. The connection is only closed when the pool decides to, according to how it was configured.
Granted, this can be confusing if you're used to working only with vanilla jdbc connections. -
3. Re: How to exploit prepared statements
armint Jan 29, 2002 12:04 AM (in response to cjohan)kashpaw, you're correct, but if an entity bean instance retains a connection, that's one connection that is not available to other clients. Until close() is called, the connection will be owned by the bean.
-
4. Re: How to exploit prepared statements
kashpaw Jan 29, 2002 8:25 AM (in response to cjohan)so close it already
-
5. Re: How to exploit prepared statements
cjohan Feb 3, 2002 12:50 PM (in response to cjohan)OK. OK. I've got more than 170,000 instances, so I'd better close it. :)
Thanks for the clarification of how the pooling works.