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

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: [BUGS] BUG #2060: Issue with Data base connection
Дата
Msg-id 4384C6B4.1090603@ejurka.com
обсуждение исходный текст
Ответы Re: [BUGS] BUG #2060: Issue with Data base connection  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
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","");
    }

}


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Andres Ledesma
Дата:
Сообщение: Re: Why is bool == java.sql.Types.BIT ??
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: [BUGS] BUG #2060: Issue with Data base connection