The only way to close db connections is to do within your servlet/jsp
application, i.e. java.sql.Connection.close().  But remember, the sql
connections in the web apps are not the physical connections.  The
physical connections are maintained by the db pool and they will remain
open after the connections in the apps are closed, until the connection
timeout is reached.

The first thing is to make sure that the sql (or logical) connections
are indeed closed in the app after an http session or user session is
completed.  The next thing may be to reduce the timeout interval of the
db connection pool.

ND

-----Original Message-----
From: Alex Turner [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 20, 2006 10:37 AM
To: users@tomcat.apache.org
Subject: Connection Pool Woes

I am using Tomcat 5.5.12 on RedHat ES 4.

I have a server that is set to maxThreads="5", maxSpareThreads="5",
and when I use a Simply Data Source, that does not pooling, if I hit
the page a lot, I get over 30 connections opened, with database
connections that are not closing quickly at all.  If this runs in
production, I'm going to run out of database connections.

If I try a pooling datasource, the same thing happens, except the
server hangs on what I assume is the process to open a new connection
once it hit's the connection pool's maxConnections number.

I am using JSTL sql and core to do database queries, and I have a
servlet called InitServlet that instantiates a DataSource and sets it
as the default datasource.

I am using Postgresql as my database, and using Jdbc3PoolingDataSource
as my pooling datasource, and PGSimpleDataSource for my simple data
source.

What can I do to get these connections to close once a servlet or JSP
has finished running?  The plan is do have dozens of applications
running on this server, and if each app has it's own connection set,
I'm gonna run out of connections really fast.

Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to