• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maintaining database connections

 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application having around 10 actions i want to connect to database in all actions.

i am using a class DBConnector whose instance will make a connection with the database specified.
i want to create an instance of this class only once in the scope of my application. that is only one connection for all clients irrespective of the session.

where should i instantiate this class to accomplish my requirement. In ActionServlet or RequestDispatcher? which method should i override to get this.
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
write it as a singleton at let it instantiate itself :-)

so you can access it from whereever you want...

regards,
jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic