wood burning stoves
The moose likes JDBC and Relational Databases and the fly likes Logging Oracle Prepared/Callable Statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Logging Oracle Prepared/Callable Statements" Watch "Logging Oracle Prepared/Callable Statements" New topic

Logging Oracle Prepared/Callable Statements

J Rosetto

Joined: Jun 03, 2008
Posts: 21
Does anyone know of a simple way of logging an Oracle prepared/callable statement? I tried calling toString() but all I receive is the object reference.

I believe the Oracle libraries have some functionality for producing their own logs but I'd rather a simpler solution which allows me to log just what I need.

Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
Have you tried log4jdbc? This library acts as a jdbc driver, logs the statements and delegates the request to underlying real driver.
J Rosetto

Joined: Jun 03, 2008
Posts: 21
Thanks Santhosh.

Unfortunately I am looking for a solution which will allow me to produce the log entries (using our company's bespoke logging library), rather than delegating the logging responsibility to another library.

I notice that the OraclePreparedStatement has a method called getRevisedSql(). I am guessing this provides what I need. Unfortunately I am using Commons DBCP, which means I only have access to DelegatingPreparedStatements which wrap the OraclePreparedStatements and so I have no access to this method.
I agree. Here's the link: http://aspose.com/file-tools
subject: Logging Oracle Prepared/Callable Statements
It's not a secret anymore!