dbTalk Databases Forums  

Re: [JDBC] [BUGS] BUG #2060: Issue with Data base connection

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [JDBC] [BUGS] BUG #2060: Issue with Data base connection in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave Cramer
 
Posts: n/a

Default Re: [JDBC] [BUGS] BUG #2060: Issue with Data base connection - 11-23-2005 , 07:48 PM






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:

Quote:
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("jdbcostgresql://
localhost:5810/jurka?logUnclosedConnections=true","jurka","");
}

}


---------------------------(end of
broadcast)---------------------------
TIP 6: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.