I use postgresql for DB and have a connection problem. The project is very big, with a lot of inner flows, and very complex... Sometimes, the app creates a lot of connections, and there are no connections left in the db, and the app freezes. The problem is not in the db, it is in the app.
When I look into pg_stat_activity, i see all the connections, and their query is select 1 (the first query that occures when connection is open, to validate the connection). So it seems that the app opens a connection, and does not use it. And when there are to many of those... you know...
I dont know where from, in the code, the connection open.
Is there a technic/tool for java/postgres to know where they come from?
From just looking at the code it will take forever.