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

Re: Display SQL from Java Prepared Statement

From: "Campbell, Lance" <lance(at)illinois(dot)edu>
To: "J(dot) W(dot) Ulbts" <magog001(at)web(dot)de>,<pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Display SQL from Java Prepared Statement
Date: 2009-08-24 03:23:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
I thought I had tried that before.  Good grief that was way to obvious.

I cannot even begin to thank you enough.  Thanks for the response. 


Lance Campbell
Project Manager/Software Architect/DBA
Web Services at Public Affairs

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org [mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of J. W. Ulbts
Sent: Sunday, August 23, 2009 11:31 AM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Display SQL from Java Prepared Statement

Hi Lance!

>Is there a way I can have the JDBC driver dump out to a log file all  
>of the SQL statements executed? I am using prepared statements.
> Note: I think the development team is doing a great job.
> Thanks,
> Lance Campbell

Just call the toString() method of the prepared statement object. That will print the prepared statements SQL. It includes not just the SQL command but also some additional text before the SQL command.
I'm using it also to write statements to the log.

Kind regards,
J. Ulbts
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter

Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org) To make changes to your subscription:

In response to


pgsql-jdbc by date

Next:From: Maciek SakrejdaDate: 2009-08-25 00:36:52
Subject: PGStream synchronization
Previous:From: VSPDate: 2009-08-24 01:33:10
Subject: [Q] Pg text[] array with Hibernate Annotation

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