concept database connection in category java

appears as: database connection, database connections
Portlets in Action

This is an excerpt from Manning's book Portlets in Action.

The init method is invoked by the portlet container after it has loaded and instantiated the portlet. The method gives the portlet instance an opportunity to initialize itself before processing any request. In the init method, the portlet instance initializes the costly resources (such as setting up a database connection or reading configuration data from an external file) that it will require for request processing. The resources initialized in the init method usually remain unchanged during the lifetime of the portlet instance.

  • Open and close the database connection
  • 9.3.2. Creating database connections

    As mentioned earlier, if you’re using Spring’s JDBC module, you don’t need to worry about managing database connections. Spring’s JDBC module provides many built-in classes that accept objects of type javax.sql.DataSource and relieve you of the responsibility of managing Connection, Statement, and ResultSet objects. Let’s look at the most popularly used class of the Spring JDBC module: JdbcTemplate.