Re: Getting query SQL from a JDBC PreparedStatement
- From: Larry Coon <lcnospam@xxxxxxxxxx>
- Date: Tue, 06 Jun 2006 13:48:25 -0700
joeNOSPAM@xxxxxxx wrote:
Nothing. There is no standard JDBC or sybase-specific
method or variable which exposes the SQL you gave the
connection when asking for a PreparedStatement. The
statement certainly does have a version of the string,
possibly modified for the JDBC SQL escapes, but you
would have to decompile, alter, and recompile, and run
your modified driver to be able to get it programmatically.
Thanks, Joe. That wasn't the answer I was expecting or hoping
for. Why wouldn't they provide that method? I assume it was
intentionally not provided, since it seems so obvious -- what
was the reason?
The workaround is straightforward -- build the string myself
instead of using the setXxxxx() methods, and send the completed
string to createStatement() or prepareStatement(). Not as
clean, but at least I have access to the completed SQL....
.
- References:
- Getting query SQL from a JDBC PreparedStatement
- From: Larry Coon
- Re: Getting query SQL from a JDBC PreparedStatement
- From: joeNOSPAM@xxxxxxx
- Getting query SQL from a JDBC PreparedStatement
- Prev by Date: Re: Hibernate mappings
- Next by Date: Scrolling large dataset
- Previous by thread: Re: Getting query SQL from a JDBC PreparedStatement
- Next by thread: crazy pooling jdbc driver on msaccess
- Index(es):
Relevant Pages
|