File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Retrieving the Query after values are set in Prepared Statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retrieving the Query after values are set in Prepared Statement" Watch "Retrieving the Query after values are set in Prepared Statement" New topic
Author

Retrieving the Query after values are set in Prepared Statement

ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Hi All

I am using Preparestatement to query the database.For this Iam setting the values and execute the queries. Is there any way by which I can get the final query which is build after all the data values are set in preparedstatement . It is very time consuming to check for the faulty data value through Java , when you have large number of columns. Can any one suggest me the best way to accomplish this.

Thanks and Regards Shiv
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The quick way I do it is to use the trace utility in my database to see the eventual procedure run, which is easy to do if you are familiar with your database.

You might consider p6spy also. It logs everything JDBC does including the values it binds in PreparedStatements.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Armando Perdomo
Greenhorn

Joined: Mar 07, 2007
Posts: 2
I believe p6spy is a great solution but it doesn't have a client and it is not easy to setup the first time. That was the reason we implemented a new solution integrating everything - Elvyx. I am pretty sure Elvyx could be useful on this kind of tasks.

BTW, it is working fine, but we need feedback from people like you. It will help us to improve the tool. Any idea, comment, etc will be appreciated.

Greetings, Armando Perdomo ;-)
http://www.elvyx.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving the Query after values are set in Prepared Statement