aspose file tools*
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
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: 1391
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: 36497
    
  16
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: One Global Remote Connection or Multiple Connections
 
Similar Threads
do we need to close context in websphere
AS400ConnectionPool class question (IBM toolbox)
AS400 ToolBox Question
JDBC?
Closing Database Connections