Possible Duplicate:
How can I get the SQL of a PreparedStatement?
I make a PreparedStatement (PS) and run some setString(int a,String b) on it. After this, how do I see what my PS finally looks like ?
If I understand you, you'd want someting like:
PreparedStatement pstmt =
connection.prepareStatement("insert into table tab(col) values(?)");
pstmt.setString(1, "my string value");
and then you want to see a string like:
"insert into table(col) values('my string value')"
Did I get your meaning right?
If so, I think you can't do that. I think the statement is precompiled without parameter values, and these are kept separately, so you can reuse the statement with different parameters.
What you can do, is to retrieve parameter metadata, like this:
ParameterMetaData pmd = pstmt.getParameterMetaData();
And then call stuff like:
pmd.getParameterCount();
pmd.getParameterClassName(1);
pmd.getParameterType(1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With