Re: JDBC question: show PreparedStatement

From: Markus Tazl <m_tazl_at_yahoo.de>
Date: Sat, 2 Feb 2008 01:21:16 -0800 (PST)
Message-ID: <e4c64831-de3c-4b44-b03a-c657d4463d4f_at_e10g2000prf.googlegroups.com>


On 31 Jan., 10:35, Joolz <r..._at_localhost.localdomain.invalid> wrote:
> Hello everyone,
>
> A small question about JDBC. When I do something like this:
>
> PreparedStatement stmt = conn.prepareStatement("select * " +
> "from fu where bar = ?");
> stmt.setString(1, "blah");
> System.out.println(stmt.toString()); // show me what will be asked
>
> I would like to see which query will be sent to the DB (i.e. "select *
> from fu where bar = 'blah'"), which would be very nice for debugging.
> toString() won't do the trick (it gives something like
> "oracle.jdbc.driver.T4CPreparedStatement_at_1e859c0"). Is there a way to
> solve this? TIA!

Hi,

  1. "old" but nice article : http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html
  2. Info on how to use JDBC driver logging : http://www.rgagnon.com/javadetails/java-0411.html

best regards
Markus Tazl

--
Markus Tazl
Received on Sat Feb 02 2008 - 10:21:16 CET

Original text of this message