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.
A connection pool is definitly the best way to go. It makes db access simpler by keeping track of all your connections for you. There us a free connection pool available at: http://www.javaexchange.com
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…