• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContextListener

 
lokesh rajarathnam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

1. I writen a code for access database connection through contextlistener,




2. Attribute class


How can i achieve the availabelity of database connection for the entier application....
if i write a servlet class for access data items from tabel, their also i need connection object, statement object and more as same like Attribute class( which shown above 2).

please any one can help me how can i write a code in servlet for access a database items.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lokesh rajarathnam:

How can i achieve the availabelity of database connection for the entier application....


You shouldn't.
Instead look into connection pooling.
All modern, spec compliant servers offer it at a container level.

What you're trying to do will give you nothing but headaches and will most likely result in a slow application.
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:

What you're trying to do will give you nothing but headaches and will most likely result in a slow application.


you know Lokesh That's completely true, it does cause headaches,,
I'm still suffering of using that way..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic