Originally posted by Timothy Sam:
Is a servlet instantiated one per user? Or one for the whole application to use? How about objects inside the servlet? Suppose I have a static object in a servlet, is it static for one user or static for the whole application? Thanks!
One servlet per application but one thread per user.The variables in servlet both static and non static are not thread safe and there for one instance is shared by the complete servlet.
1. Create a single connection for each thread, determine if that thread already has a connection object and if not instantiate one...
2. Just instantiate a connection for every DB transaction.
Aaaaaak! I didn't imagine this to be such a problem!
Could you please refer me to links about container-managed connection pool? I happen to have a class which I plan to twist and follow the DAO pattern. Will container-managed connection pool adapt to this? Thanks!