Active Sessions - killing them via Sql

From: "Carl Olivier" <carl(at)zero-one(dot)co(dot)za>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Active Sessions - killing them via Sql
Date: 2003-03-06 12:34:36
Message-ID: BCEKIKAMLDKFEKBNELFKEELHCGAA.carl@zero-one.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings.

I need to be able to call the DROP DATABASE via Sql - i.e. I cannot run any
scripts on the actual POSTGRES server as I am remotely connecting to it over
TCP/IP via JDBC.

Unfortunately I need to kill off any active connections to the specified
database before the DROP DATABASE command will work.

Is there anyway from within a JDBC connection to say the template1 database
as the superuser on a POSTGRESQL server to:

1. Determine what connections are open and active to a specified database
(this I can get from the stats tables)
2. Kill ALL these sessions. (or specifiy each and kill thme
individually)...

I am using POSTGRES version 7.3.2.

Thank you in advance,

Carl Olivier

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2003-03-06 13:23:08 Postgresql.org site outage
Previous Message Shridhar Daithankar<shridhar_daithankar@persistent.co.in> 2003-03-06 11:21:06 GUI for postgresql