Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One Global Remote Connection or Multiple Connections

 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49405
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not convinced that is a bona fide beginner's question. I think I ought to move the thread.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tying connections to sessions is not always a good idea.

Are these JDBC connections?
If so, have you considered connection pooling?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic