wood burning stoves 2.0*
The moose likes Servlets and the fly likes One Global Remote Connection or Multiple Connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "One Global Remote Connection or Multiple Connections" Watch "One Global Remote Connection or Multiple Connections" New topic
Author

One Global Remote Connection or Multiple Connections

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
My web requires many connections to remote data sources. When I say many I mean I get data from many files located on our AS400 server. As of right now every time data is needed I create a connection using AS400 Java Tool Kit library, get my data then close the connection. My boss wants me to find out if it would be more effeicent to open one connection as a user starts a session and close it when they end the session versus the many opening and closeing connection. Can someone help answer this. And how would I set up a connection that is available to all my servlets and classes? I have tried to set a connection to a session attribute but can not get this to work when I need to use it as a connction.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38057
    
  22
Not convinced that is a bona fide beginner's question. I think I ought to move the thread.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Tying connections to sessions is not always a good idea.

Are these JDBC connections?
If so, have you considered connection pooling?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: One Global Remote Connection or Multiple Connections
 
Similar Threads
AS400 ToolBox Question
JDBC?
AS400ConnectionPool class question (IBM toolbox)
do we need to close context in websphere
Closing Database Connections