> Hi, the environment is Java 1.5, Tomcat 5.5, Postgres 8.1, Eclipse
> 3.1.1 and Windows XP Pro.
[quoted text clipped - 8 lines]
>
> Thank you.
First, Debuggers have special access.
Second, you can use reflection to access protected properties.
Third, Don't use reflection to access protected properties...
Generally, even if the PreparedStatement has a string property which
holds the "statement", it is actually just a place-holder reference
for a statement that is already compiled on your SQL server. Changing
the stmt at best would have no effect, and at worse would cause
undefined behavior. Its a bad idea to violate access constraints,
even if you are able.
Gello Ramello - 30 Apr 2007 21:06 GMT
Daniel Pitts ha usato la sua tastiera per scrivere :
> Generally, even if the PreparedStatement has a string property which
> holds the "statement", it is actually just a place-holder reference
> for a statement that is already compiled on your SQL server. Changing
> the stmt at best would have no effect, and at worse would cause
> undefined behavior. Its a bad idea to violate access constraints,
> even if you are able.
Thank you for your answer, indeed I want to read only the "statement",
not to change it or its properties. The goal is to read the sql string
and the parameters passed to the statement itself. Do you know any way
to do the job? Just to abuse of your courtesy ;-)
Robert Klemme - 02 May 2007 12:16 GMT
> Daniel Pitts ha usato la sua tastiera per scrivere :
>> Generally, even if the PreparedStatement has a string property which
[quoted text clipped - 8 lines]
> and the parameters passed to the statement itself. Do you know any way
> to do the job? Just to abuse of your courtesy ;-)
Since PreparedStatement is an interface you can as well write wrapper
classes and thusly intercept method calls.
robert
Gello Ramello - 02 May 2007 12:41 GMT
Robert Klemme ha usato la sua tastiera per scrivere :
> Since PreparedStatement is an interface you can as well write wrapper classes
> and thusly intercept method calls.
Thank you, is just what I've found here:
http://www-128.ibm.com/developerworks/java/library/j-loggable.html
I've just implemented the wrapper taylored to my needs.
Thank you again.