3

I am rewriting a very old project, it uses 1.4 JDK and java.util.logging. It uses a JDBC connection to Oracle. I'm trying to log all the SQL calls to Oracle from the java program, is it possible? I already swapped the driver to use classes14_g.jar and enabled the Oracle trace. The call like this:

stmt = (OracleCallableStatement) tr.createCallableStatement(sqlString,1);
  oracle.jbo.domain.Date jboDate = DateUtil.parseDateString(monthEndDate);
  stmt.setDATE(1,jboDate );
  stmt.executeUpdate();

Still not logged, any suggestion is welcome.

1 Answer 1

3

One option would be to use a spy driver to intercept all JDBC calls and log them. There are several of these available, including one by BEA (now Oracle):

If you fancy more control (and more work), you can utilize AOP to intercept calls to your JDBC driver and then log them, but I feel thats alot of effort for not a ton of gain.

Sign up to request clarification or add additional context in comments.

5 Comments

so I guess by using classes14_g.jar won't provide me the log
Well, thats an Oracle trace - what is logged in it will depend on what they are tracking in their own implementation classes. Theoretically they should log everything but without looking into their code it would be impossible to say.
In fact, I use jad to uncompile the code and see they actually log the callableStatement, but still not able to display the message. not sure how should I config the log. but I will give the interceptor/spy driver a try.
@Perception thanks for the links. Does this feature affect performance? Are these asynchronous?
@SidCool - the logging calls do slow down performance, though not by an incredible amount. Typically, you would only do this in a debug/prototyping environment (definitely not production).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.