Log SQL-Statements generatet by Tomcat

A

antonberg1

Hi,

is there any possibility to log all SQL-Statements executed by the
Oracle JDBC-Driver from a Servlet running on Tomcat 4.1.29? Especially
is it possible to log preparedStatements?

Surely, there is a logging system in the software we have, but when
using a preparedStatement, then a '?' is logged.

I read about P6Spy, but there is no installation guide for Tomcat 4.1.

Please help me!
Anton
 
J

Juha Laiho

(e-mail address removed) said:
is there any possibility to log all SQL-Statements executed by the
Oracle JDBC-Driver from a Servlet running on Tomcat 4.1.29? Especially
is it possible to log preparedStatements?

Surely, there is a logging system in the software we have, but when
using a preparedStatement, then a '?' is logged.

Ok. You'll need to additionally log the bind values used. And that's
what prepared stateemnts basically are -- you send the statement
template with a few placeholders for bind values to the statement -
then later on you thell the database to bind certain values to
the placeholders in a certain prepared statement, and fire off your
request.

If you want to log that, you'll more or less need to log some
"symbolic" name for your prepared statement, along with the
bind values used for a given query.

Depending on your Oracle JDBC driver version, the driver may have
a debug mode -- see the documentation for the driver (documentation
available on otn.oracle.com, for registered users).
 
A

antonberg1

Hi,

what do you think of P6Spy? Will this help me with preparedStatements?

Thanks for your help!
Anton
 
J

javabuddha

P6Spy does many more things:

- It will help you with the prepared statements.
- It will log the parameters going into the database and the values
coming out.
- It track the time each statement takes and which JDBC connection it
belongs to.

There are also tools that parse the P6Spy log files and point out the
trouble spots
for your applications. There should be a lot of articles on the web on
how to
integrate P6Spy with Tomcat.

Goog luck,

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top