Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id DE23D2E0032 for ; Tue, 19 Feb 2008 21:34:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 30168-03-3 for ; Tue, 19 Feb 2008 21:34:04 -0400 (AST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by postgresql.org (Postfix) with ESMTP id 705662E0056 for ; Tue, 19 Feb 2008 21:34:09 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d37so4120906pye.29 for ; Tue, 19 Feb 2008 17:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; bh=ghST85Yfw8tdjCfmLprRvn9Vl9+7PKpg5BSSe2mL2BM=; b=dAop5KP/xjx22q2TxIjLgwWoLdrRxYEUDks3HFwPQ8OD6PvAJgHOk3IWRnbC0qRVt7CzHpxLaFICtyGhCPPNOpT3kHSlHba5M8KBN/zQA4BezLDi8mZa3WjxX2nBjzwFBrA6l/02M/3T90frgUBBu4Iu0m+pACWcHZsku6Dfqes= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=vdMAPyvVhR+uNxVkoEOWTwkktd7qN24C9PK2VG577pHlVBPynw7ErkxK2sDCsIhL7ejVLgdV4RX+HEIiMRrsV5V/GYHB/3Vi/BKeU4R/MeYc2n4C74M4dP6GIGD8nhF51wlA0IZkBUX+C2w5LazCrzcgtdbUUtRCszkWRc2pxos= Received: by 10.35.79.3 with SMTP id g3mr9131696pyl.3.1203471248037; Tue, 19 Feb 2008 17:34:08 -0800 (PST) Received: from albook.local ( [69.207.169.30]) by mx.google.com with ESMTPS id y45sm9904611pyg.9.2008.02.19.17.34.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 19 Feb 2008 17:34:06 -0800 (PST) Message-ID: <47BB838D.5070903@gmail.com> Date: Tue, 19 Feb 2008 20:34:05 -0500 From: Paul Tomblin User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: How to find what Java program has a transaction open? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200802/151 X-Sequence-Number: 18358 I got the following query from a comment on the PostgreSQL site: select pg_stat_activity.datname,pg_class.relname,pg_locks.transaction, pg_locks.mode,pg_locks.granted,pg_stat_activity.usename,substr(pg_stat_activity.current_query,1,30), pg_stat_activity.query_start, age(now(),pg_stat_activity.query_start) as "age", pg_stat_activity.procpid from pg_stat_activity,pg_locks left outer join pg_class on (pg_locks.relation = pg_class.oid) where pg_locks.pid=pg_stat_activity.procpid and pg_class.relname not like 'pg_%' order by query_start; and it's great, in that it shows me what Postgres PID is holding the lock, and on what table. But what I don't know is how to figure out what Java program it is that's got the lock. If I do a "ps auwwx | grep [pid]", the socket number will be part of the command line for that process, and then I can use "lsof -i :[socketnumber]" which shows me two tasks that have that socket open, the PostgreSQL task and the Java task, and then I can use "ps auwwx | grep [pid]" to find the arguments to the Java task, including the main class. Is there a more direct way? -- Paul Tomblin http://blog.xcski.com/ Compared to system administration, being cursed forever is a step up. -- Paul Tomko