Re: [ADMIN] JDBC and servlet... - Mailing list pgsql-jdbc
From | Nick Fankhauser |
---|---|
Subject | Re: [ADMIN] JDBC and servlet... |
Date | |
Msg-id | NEBBLAAHGLEEPCGOBHDGGECGENAA.nickf@ontko.com Whole thread Raw |
List | pgsql-jdbc |
James- This problem ought to get posted over on the postgresql JDBC list- I'll cc this reply on that list. (You may even find some Resin users over there.) Here's the only thought that occurs to me based on my experiences with Tomcat- Is it possible that when running with Resin, that at some point after the connection is made but before it gets closed, the original connection instance gets lost? More specifically, since you'll be running many instances via the web connection, could it be that the first one connects fine, uses the connection, and then before it gets closed, a second connection is instantiated that invalidates the handle that you have for the first one? perhaps you could test the connection to see if it is null just before closing as a check. As an aside, if you're running a serious web-app you'll want to use a connection pool or you'll quickly run out of connections even if they are getting closed properly- you also don't want the performance hit of establishing and closing a new connection for each web access. Most of the problems that we've had with Tomcat vs the command line arise either from our failure to plan initially for the fact that many instances are running side by side in this environment, *or* from the change of context that arises because instead of running from the developer's account, we're now running from the account that apache/tomcat use (www-data in most cases). One way to bench-test the second issue would be to do an "su - www-data" while running your tests from the command line. Hope this helps! -Nick -------------------------------------------------------------------------- Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/ > -----Original Message----- > From: pgsql-admin-owner@postgresql.org > [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of James Kelty > Sent: Friday, April 19, 2002 12:33 PM > To: pgsql-admin@postgresql.org > Subject: [ADMIN] JDBC and servlet... > > > We seem to be having an issue with the JDBC driver, Resin 2.0.5 servlet > engine, and/or postgres 7.1.2. > > Basically what happens is this. In the Java Servlet code, the programmers > are making an explicit close connection call to the database through the > JDBC driver (As they should). Now! When the code us run from the command > line, instead of through the servlet engine (Resin 2.0.5), > everything works > fine. The connection is made to the database, the SQL queries are run, the > output is taken, and the connection to the DB is closed. But! When run > through the servlet engine, the connection is never dropped, and we end up > with these stale connections to the DB, and eventually, we cannot connect, > since the older connections are never closed. Same code, same JVM, same > database, but Resin sits in the middle. Resin isn't really doing anything > other than passing the HTML output to Apache. > > I am also posting this to caucho.com incase it is a Resin issue, but if > anyone has had this problem before, all help would be appreciated > very much. > Thank you! > > -James > > James Kelty > Sr. Unix Systems Administrator > Everbase Systems > 541.488.0801 > jamesk@everbase.net > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
pgsql-jdbc by date: