Reputation: 856
I am using PostgreSQL database in the JSP website.
Somewhere my connection is not closed in code. So port was opened by the PostgreSQL was remained in ESTABLISHED situation and remained in that state only.
After sometime number of ports exceeds the limit of PostgreSQL total limit and than I have to manually restart the PostgreSQL from Linux by,
service PostgreSQL restart
Is there any way to delete all the ports opened by PostgreSQL through JAVA file?
Upvotes: 3
Views: 776
Reputation: 1054
I strongly recommend fixing the connection leak in your code.
Upvotes: 1
Reputation: 7848
Take a look at the pg_cancel_backend() function: http://www.postgresql.org/docs/8.2/static/functions-admin.html
However, you should consider trying to fix the unclosed connections in your code as you are likely to run into memory issues and other strangeness.
Upvotes: 3