Thread: Postgres is not closing JDBC connection .. Please help

Postgres is not closing JDBC connection .. Please help

From
Deepak Malhotra
Date:
Hello

I am using POstgres 7.3 and jdbc driver
org.postgresql.Driver.

I am using jdbc driver for PostgreSQL to connect to
the database and when I am closing the database
connection using Java but it seems PostgreSQL does not
close the connection actually. If the web page, which
uses the database connection, was visited
consecutively it freezes when trying to connect to the
database

Only solution is to shutdown Postgres Database and
restart it and it is not a very good solution.

Any Suggestion to clean jdbc connection in Postgres
database.

Thanks

Deepak

=====
Deepak Malhotra
Phoenix, AZ

deepakjm@yahoo.com

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk

Re: Postgres is not closing JDBC connection .. Please help

From
Hornyak Laszlo
Date:
I think you should fix this in the java code, because PostgreSQL cannot
say goodye for the client. For example close connection in the "finally"
block, so it will be closed even if the code inside has a failure.

On Mon, 15 Sep 2003, Deepak Malhotra wrote:

> Hello
>
> I am using POstgres 7.3 and jdbc driver
> org.postgresql.Driver.
>
> I am using jdbc driver for PostgreSQL to connect to
> the database and when I am closing the database
> connection using Java but it seems PostgreSQL does not
> close the connection actually. If the web page, which
> uses the database connection, was visited
> consecutively it freezes when trying to connect to the
> database
>
> Only solution is to shutdown Postgres Database and
> restart it and it is not a very good solution.
>
> Any Suggestion to clean jdbc connection in Postgres
> database.
>
> Thanks
>
> Deepak
>
> =====
> Deepak Malhotra
> Phoenix, AZ
>
> deepakjm@yahoo.com
>
> ________________________________________________________________________
> Want to chat instantly with your online friends?  Get the FREE Yahoo!
> Messenger http://mail.messenger.yahoo.co.uk
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>


Re: Postgres is not closing JDBC connection .. Please help

From
Tom Lane
Date:
=?iso-8859-1?q?Deepak=20Malhotra?= <deepakjm@yahoo.com> writes:
> I am using jdbc driver for PostgreSQL to connect to
> the database and when I am closing the database
> connection using Java but it seems PostgreSQL does not
> close the connection actually.

You've got that backwards: Java is not closing the Postgres connection.
You could be falling afoul of connection-pooling features in the JDBC
driver, perhaps.  Ask in the JDBC list if you need more help.

            regards, tom lane