PreparedStatement and prewiev SQL query

T

tomas

I have question it is posible to see SQL query when I use PreparedStatement
and print SQL query to console ?
 
G

Guest

tomas said:
I have question it is posible to see SQL query when I use
PreparedStatement and print SQL query to console ?

Yes. But only with the ? not with the data.

Arne
 
T

Tom Cole

tomas said:
I have question it is posible to see SQL query when I use PreparedStatement
and print SQL query to console ?

Not all drivers support this, and it's not part of the standard, but
many will allow you to call toString() (after you've set your
parameters) and see the SQL Statement.

Connector/J does this, the PostgreSQL driver does this as well. I
haven't tried jTDS or the JDBC/ODBC Bridge...

You may also find this useful:

http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top