How to kill the idle connection in Postgresql.? -


i using java servlets along pgadmin 9.1.problem connection in servlets not closed leads blank screen if reaches maximum connection.i don't want every user extend maximum connections in pgadmin...i have used below query in starting , end ending point of servlet showing error like..connection terminated due administrator command..

resultset rs_1q=st_query3.executequery("select pg_terminate_backend(pg_stat_activity.procpid)from pg_stat_activity pg_stat_activity.current_query = '<idle>' , procpid <> pg_backend_pid();"); 

i dont think killing connection ideal solution there may connection might genuinely waiting transaction completed. instead suggest set timeout transacion.

however if desperate kill idle connections can try this:

use shell script , "ps auxwww|grep 'idle in transaction'" return list of "idle in transaction." processes. can use "awk" , find of each line of output process id, , can use "kill <pid>" each process.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -