Solved

Sql prepared stmts

Posted on 2004-04-22
3
254 Views
Last Modified: 2010-03-31
Is there a way to show the SQL behind a prepared stmt.

System.out.println (strSQL); //works when one is composing string sql statement

PreparedStatement pst = null;
...
System.out.println (pst. ?);  //what do I use to see sql here? (After parameters have been assigned, of course)
0
Comment
Question by:Paullkha
  • 2
3 Comments
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10896097
0
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 75 total points
ID: 10896191
Unless you write your own driver there is currently no way to do what you want. The closest you can get is by using the method nativeSQL(String sql). You can filter your SQL string through it with the ? placeholders in place.
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 11099184
=-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Free Alternative to JIRA 4 91
recursion example 16 111
Java Server Faces parameter pass? 6 39
HSSFWorkbook cannot be resolved error 10 50
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now