pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <jurka@ejurka.com>
To: kalisetty manideep <mani7deep@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #2060: Issue with Data base connection
Date: Wed, 23 Nov 2005 11:44:52 -0800
Message-ID: <4384C6B4.1090603@ejurka.com> (raw)
In-Reply-To: <20051122044944.25648.qmail@web30705.mail.mud.yahoo.com>
References: <20051122044944.25648.qmail@web30705.mail.mud.yahoo.com>

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

Attachments:

OpenConn.java (text/x-java, 377B) download 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",""); } }

view thread (2+ messages)  latest in thread

Message-ID: <4384C6B4.1090603@ejurka.com>
Permalink:  ../4384C6B4.1090603@ejurka.com/
Also on:    postgresql.org/message-id/4384C6B4.1090603@ejurka.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: jurka@ejurka.com, mani7deep@yahoo.com, pgsql-bugs@postgresql.org
  Subject: Re: BUG #2060: Issue with Data base connection
  In-Reply-To: <4384C6B4.1090603@ejurka.com>
  References: <20051122044944.25648.qmail@web30705.mail.mud.yahoo.com> <4384C6B4.1090603@ejurka.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox