Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

tomcat connection pooling

652628Aug 11 2010 — edited Aug 13 2010
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!!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2010
Added on Aug 11 2010
13 comments
415 views