Skip site navigation (1) Skip section navigation (2)

Re: How to get the SQL query from a PreparedStatement?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Andres Olarte <olarte(dot)andres(at)gmail(dot)com>
Cc: "Pgsql-Jdbc(at)Postgresql(dot)Org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: How to get the SQL query from a PreparedStatement?
Date: 2007-11-06 07:45:46
Message-ID: 47301BAA.1000804@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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

In response to

Responses

pgsql-jdbc by date

Next:From: Phillip MillsDate: 2007-11-06 14:09:35
Subject: Beginning tuning
Previous:From: Kevin NeufeldDate: 2007-11-06 04:47:03
Subject: Re: Parsed Query Trees

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group