Log SQL-Statements generatet by Tomcat

Discussion in 'Java' started by antonberg1@gmx.de, Jan 24, 2006.

  1. Guest

    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
     
    , Jan 24, 2006
    #1
    1. Advertising

  2. Juha Laiho Guest

    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).
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)
     
    Juha Laiho, Jan 24, 2006
    #2
    1. Advertising

  3. Guest

    Hi,

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

    Thanks for your help!
    Anton
     
    , Jan 24, 2006
    #3
  4. Guest

    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


    wrote:
    > Hi,
    >
    > what do you think of P6Spy? Will this help me with preparedStatements?
    >
    > Thanks for your help!
    > Anton
     
    , Jan 24, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Zanella
    Replies:
    8
    Views:
    1,196
    mfmehdi
    Oct 20, 2006
  2. Harry George
    Replies:
    6
    Views:
    384
    Bart Nessux
    Feb 23, 2004
  3. Vince
    Replies:
    12
    Views:
    751
    Martin Gregorie
    Jan 21, 2008
  4. JT
    Replies:
    1
    Views:
    120
    Bob Barrows [MVP]
    Sep 27, 2005
  5. John Crichton
    Replies:
    6
    Views:
    267
    John Crichton
    Jul 12, 2010
Loading...

Share This Page