A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Get SQL value out of PreparedStatement - Any API
Joined: Jul 21, 2003
Feb 17, 2006 15:23:00
Is there a way to get the SQL out of a PreparedStatement?
PreparedStatement prepStmnt = conn.prepareStatement("select * from table");
Is there any API that will let me extract the sql that is the inherent part of prepStmnt.
Goal is to get "select * from table" value out of prepStmnt variable.
Joined: Dec 15, 2005
Feb 17, 2006 17:09:00
Not in standard
Some drivers may have vendor-supplied add-ons to do that.
Some people create "wrapper" classes that will store the SQL and the bind variable values and give them up on request.
Joined: Mar 06, 2001
Feb 17, 2006 18:10:00
If you search this forum for 'DebuggableStatement' it will give you one option of that type, and links to a few more.
It is sorta covered in the
JavaRanch Style Guide
subject: Get SQL value out of PreparedStatement - Any API
Update D/b with Java variable
help! perhaps the problems of configuration of JDBC on Weblogic
Can PreparedStatements take care of this ?
SetNull in a PreparedStatement
Can I use prep.execute to update a record?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014