Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to organize the connection through out the application process

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


Here in my application is using the following steps for a process.
- Login
- Search
- Update
- Logout

In those above steps, Login, Search, and Update actions are touching to database everytime. In each time, Im getting the Context object, I think this is a bad approach. When I hit the login, I need to get the connection object and use that for rest of the actions(search and update).

So can we organize the single connection through out the application? And where do we need to close the Context object?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar,
Most people have a connection pool and don't manage connections at the user level. Then the application can ask for a connection whenever it needs in rather than passing it around.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here one thing, I forgot to mention that the context is for LDAP not for DB. I know how to make manage connection using for DB but I don't know how to use it for LDAP.
 
Kalyan Ram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhakar Kumar wrote:Here one thing, I forgot to mention that the context is for LDAP not for DB. I know how to make manage connection using for DB but I don't know how to use it for LDAP.

errr since you are still dealing with j.l.Object, maybe you could use Commons Pool - http://commons.apache.org/pool/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic