JSP's, Servlets and Database
Posted on 2001-06-07
When developing a Web application that uses databases in either JSP's or Servlets is it good practice to open the connection to the database in every Servlet or JSP that requires a database connection or would it be more appropriate to manage all database access via a bean ?
If it is best to manage all database access via a bean would it be appropriate to store this bean in the session object (so that it is created for each user session) or would it be more appropriate to store it in the application object ? My concern here is related to the overhead of opening many connections to a database.
I would be grateful for all advice offered regarding this.
Thanks in advance