3
votes

I am trying to show (print in console) the SQL queries corresponding to the ADF-BC's one. I don't know how to do this with Jdeveloper 11.1.1.1.0 and Oracle 11g. I just want to see what SQL queries are going to be executed before sending them to Oracle. The problem is I am working on an existing web application (written in ADF-BC) and the response time is too high. So I'd like to test the query with SQL Developer and make some 'Explain plan' to see how I can optimize it.

Or, if someone knows how to get a SQL query string (in debug mode) from the executeQueryForCollection(Object qc, Object[] params, int noUserParams) method?

3

3 Answers

3
votes

With Oracle 12c and JDeveloper 12.1.3, you have two options:

  • If you use integrated weblogic server, you can configure Oracle Diagnostic Logging (Clic on Actions menu in server log window), and put oracle.jbo to level FINEST
  • You can retrieve your SQL query in subclass implementing oracle.jbo.server.ViewObjectImpl, in executeQueryForCollection(Object qc, Object[] params, int noUserParams) by logging or watching value of this.getQuery()
2
votes

Run the app with the Java runtime option -Djbo.debugoutput=console This will print the info in the log window. It with I'll print very much information so you should turn it off quickly. To get the same info in a file use -Djbo.debugoutput=file This will print the info into a file and only the file name is written to the log.

1
votes

Enabling diagnostic messages in standalone WLS Tested in 12.2.1.2

In the following example will be using the WLS that is shipped with JDeveloper as a standalone in a Windows machine.
Go to WLS bin directory. In our case %JDEV_SYSTEM_DIR%\DefaultDomain\bin\ eg C:\JDeveloper\mywork\system11.1.1.3.37.56.60\DefaultDomain\bin\ (Note: Check related post to find out the JDEV_SYSTEM_DIR from log of the running WLS.)

Open file setDomainEnv.cmd On the top of the file after the comments enter the following line

set DIAGNOSTIC_OPTIONS=-Djbo.debugoutput=file -Djbo.logging.show.function=true

Then modify the following line

set JAVA_PROPERTIES=-Dwls.home=%WLS_HOME% -Dweblogic.home=%WLS_HOME%

(in the same line.) to

set JAVA_PROPERTIES=-Dwls.home=%WLS_HOME% -Dweblogic.home=%WLS_HOME% %DIAGNOSTIC_OPTIONS%

http://adfhowto.blogspot.ca/2011/01/enable-diagnostic-messages-on-you.html