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

Re: Display SQL from Java Prepared Statement

From: "J(dot) W(dot) Ulbts" <magog001(at)web(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Display SQL from Java Prepared Statement
Date: 2009-08-23 16:31:12
Message-ID: 880308007@web.de (view raw or flat)
Thread:
Lists: pgsql-jdbc
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 http://movieflat.web.de


Responses

pgsql-jdbc by date

Next:From: VSPDate: 2009-08-24 01:33:10
Subject: [Q] Pg text[] array with Hibernate Annotation
Previous:From: Tom LaneDate: 2009-08-22 13:48:27
Subject: Re: Hibernate and Postgres 8.3/8.4

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