X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 43EADDA9AE for ; Wed, 23 Nov 2005 16:52:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85132-03 for ; Wed, 23 Nov 2005 20:52:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 28E33DA4BE for ; Wed, 23 Nov 2005 16:52:44 -0400 (AST) Received: (qmail 29762 invoked from network); 23 Nov 2005 20:52:45 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 23 Nov 2005 20:52:45 -0000 In-Reply-To: <4384C6B4.1090603@ejurka.com> References: <20051122044944.25648.qmail@web30705.mail.mud.yahoo.com> <4384C6B4.1090603@ejurka.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: kalisetty manideep , pgsql-jdbc@postgresql.org, pgsql-bugs@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: [JDBC] BUG #2060: Issue with Data base connection Date: Wed, 23 Nov 2005 15:52:43 -0500 To: Kris Jurka X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/249 X-Sequence-Number: 13613 It's interesting to note that *everyone* else using the JDBC driver doesn't have this problem ? Dave On 23-Nov-05, at 2:44 PM, Kris Jurka wrote: > kalisetty manideep wrote: >> [Backend reports "too many open connections"] > > >> But I am 100% sure that its not the issue with the >> code. >> Do you know any Postgresql - JDBC driver, which is not >> from Postgresql development group. I think JDBC driver >> is not closing the connection even though I am closing >> the connection. > > I have no reason to believe that and you certainly haven't shown that. > >> Please refer to the DBACCESS file attached. > > All this shows is the Connection being opened, not closed. > > I've implemented an idea I got from rupa in #postgresql a while ago > about a way of logging leaked connections. I've added some code to > the Connection's finalize() method that prints some logging > information if the Connection was not closed. This is enabled by > using the new logUnclosedConnections URL parameter. > > See the attached code for an example. I've put up a new jar that > contains this here: http://www.ejurka.com/pgsql/jars/km > import java.sql.*; > > public class OpenConn { > > public static void main(String args[]) throws Exception { > Class.forName("org.postgresql.Driver"); > leakConnection(); > System.gc(); > } > > private static void leakConnection() throws Exception { > Connection conn = DriverManager.getConnection("jdbc:postgresql:// > localhost:5810/jurka?logUnclosedConnections=true","jurka",""); > } > > } > > > ---------------------------(end of > broadcast)--------------------------- > TIP 6: explain analyze is your friend