What is more appropriate?
1) Caching database connection as a member variable in Stateless beans or
2) Getting a connection on a need basis and then releasing it?
-
Caching in Stateless beans? (3 messages)
- Posted by: Rahul Gokhale
- Posted on: January 31 2003 05:32 EST
Threaded Messages (3)
- Caching in Stateless beans? by Brian Chan on January 31 2003 10:08 EST
- Caching in Stateless beans? by Kiran Nallam on February 03 2003 04:25 EST
- Caching in Stateless beans? by David Jones on January 31 2003 13:50 EST
-
Caching in Stateless beans?[ Go to top ]
- Posted by: Brian Chan
- Posted on: January 31 2003 10:08 EST
- in response to Rahul Gokhale
Cache the DataSource Looked up from JNDI in the Stateless Session Bean and create connection on need basis and release ASAP. -
Caching in Stateless beans?[ Go to top ]
- Posted by: Kiran Nallam
- Posted on: February 03 2003 04:25 EST
- in response to Brian Chan
This depends on your application requirement. Suppose your application has transaction then you should get the new connection for each request. If your application has no transaction then you can go with the first case. Also that your application should be used more frequently. Otherwise caching of connection is not good as per performance. Here the main thing is your connection should be used at very frequent intervals of time. Otherwise one connection will be struck at your stateless session bean. -
Caching in Stateless beans?[ Go to top ]
- Posted by: David Jones
- Posted on: January 31 2003 13:50 EST
- in response to Rahul Gokhale
Is you are using (1) then you will end up with transaction and connection starvation issues.
Use (2).