Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging Oracle Prepared/Callable Statements

 
J Rosetto
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks
 
Santhosh Kumar
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried log4jdbc? This library acts as a jdbc driver, logs the statements and delegates the request to underlying real driver.
 
J Rosetto
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic