Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3363B9F9251 for ; Tue, 6 Nov 2007 03:45:29 -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 19949-07 for ; Tue, 6 Nov 2007 03:45:05 -0400 (AST) Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by postgresql.org (Postfix) with ESMTP id 1BD999F924F for ; Tue, 6 Nov 2007 03:45:25 -0400 (AST) Received: from 219-88-219-238.jetstream.xtra.co.nz ([219.88.219.238] helo=[10.1.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1IpJ7f-0000JQ-UY; Tue, 06 Nov 2007 20:45:20 +1300 Message-ID: <47301BAA.1000804@opencloud.com> Date: Tue, 06 Nov 2007 20:45:46 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Andres Olarte CC: "Pgsql-Jdbc@Postgresql.Org" Subject: Re: How to get the SQL query from a PreparedStatement? References: <3fccaa690711051819s15082dehd5c67951a6e43dee@mail.gmail.com> In-Reply-To: <3fccaa690711051819s15082dehd5c67951a6e43dee@mail.gmail.com> 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.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200711/9 X-Sequence-Number: 17764 Andres Olarte wrote: > Is it possible to get the query string (including the formatted > parameters) from a PreparedStatement? In general you can't because the query's not sent like that (the parameter values are sent out of line from the query). IIRC, PreparedStatement.toString() will give you an approximation, but I'm not sure how accurate the results are (and it's not part of the spec) -O