Hi, How can I display the Query with all the ? replaced with its original value in a PreparedStatement?
Thanks in advance..
Joined: Jun 26, 2002
Surprisingly I don't think you can.
Recently I implemented a performance monitoring driver (www.jamonapi.com) that needed to see what sql was associated with a PreparedStatement and I kept the info in a WeakHashMap to do that. WeakHashMap contents are garbage collected when they go out of scope. Very cool.
i.e. map.put(preparedStatement, sqlString);
Then you look up the sqlString by passing the preparedStatement back to the map when it is needed.