Hi,
We have developed one web application. There is no connection pooling exists right now. We are using msaccess as database . Now we are planning to use tomcat connection pooling. Once we get the connection from datasource, do we need to close the connection? or will it automatically close the connection by the tomcat connection pool?
javax.naming.InitialContext context = new InitialContext();
// Look up the data source
javax.sql.DataSource dataSource =
(javax.sql.DataSource)context.lookup ("java:comp/env/jdbc/mydb");
// Get a connection from the pool
java.sql.Connection conn = dataSource.getConnection();
We have not closed the connection in the application. But we have made our application as singleton as to make sure that only one connection is created.
In the following line which is taking care about the connection pooling?MaxActive or MaxWait?
<value>org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter><name>maxActive</name><value>100</value></parameter>
<parameter><name>maxWait</name><value>100</value></parameter>
I need valuable suggestions!!!