Monitoring WebLogic JDBC Resources 13-7
import javax.naming.InitialContext; import javax.naming.NamingException;
public class test { public static void mainString args[] {
try { WLSTInterpreter interpreter = null;
String user=user1; String pass=pw12ab;
String url =t3:localhost:7001; Environment env = new Environment;
env.setProviderUrlurl; env.setSecurityPrincipaluser;
env.setSecurityCredentialspass; Context ctx = env.getInitialContext;
interpreter = new WLSTInterpreter; interpreter.exec
connect+user+,+pass+,+url+; interpreter.execedit;
interpreter.execstartEdit; interpreter.exec
cdServersmyserverServerDebugmyserver; interpreter.execsetDebugJDBCSQL,true;
interpreter.execsave; interpreter.execactivate;
} catch Exception e { System.out.printlnException +e;
} }
} Using the WLST is a dynamic method and can be used to enable debugging while the
server is running.
13.3.1.4 Changes to the config.xml File
Changes in debugging characteristics, through console, or WLST, or command line are persisted in the config.xml file. See
Example 13–1 :
Example 13–1 Example Debugging Stanza for JDBC
. .
. server
namemyservername server-debug
debug-scope nameweblogic.transactionname
enabledtrueenabled debug-scope
debug-jdbcsqltruedebug-jdbcsql server-debug
server .
. .
This sample config.xml fragment shows a transaction debug scope set of debug attributes and a single JDBC attribute.
13-8 Oracle Fusion Middleware Configuring and Managing JDBC Data Sources for Oracle WebLogic Server
13.3.2 JDBC Debugging Scopes
The following are registered debugging scopes for JDBC:
■
DebugJDBCSQL scope weblogic.jdbc.sql - prints information about all JDBC methods invoked, including their arguments and return values, and thrown
exceptions.
■
DebugJDBCConn scope weblogic.jdbc.connection - trace all connection reserve and release operations in data sources as well as all application requests to get or
close connections.
■
DebugJDBCRMI scope weblogic.jdbc.rmi - similar to JDBCSQL but at the RMI level; turning on this one and JDBCSQL will get two sets of debug messages for
each operation called from a client.
■
DebugJDBCInternal scope weblogic.jdbc.internal - low level debugging in weblogicjdbccommoninternal related to the data source, the connection
environment, and the data source manager.
■
DebugJDBCDriverLogging scope weblogic.jdbc.driverlogging - enables JDBC driver level logging this replaces ServerMBean JDBCLoggingEnabled and
getJDBCLogFileName. Note that to get driver level tracing for Oracle, you need to use ojdbc14_g.jar instead of ojdbc14.jar. Note that for this debug scope, it can be
turned on once via the command line or configuration when the server is booted but cannot be turned on or off dynamically due to the DriverManager interface.
13.3.3 Request Dyeing
Another option for debugging is to trace the flow of an individual typically dyed application request through the JDBC subsystem. For more information, see
Configuring the Dye Vector via the DyeInjection Monitor in Configuring and Using the Diagnostics Framework for Oracle WebLogic Server.
Note: Oracle WebLogic JDBC Spy logs detailed information about JDBC calls
issued by an application and then passes the calls to the wrapped Oracle Type 4 JDBC driver. You can use the information in the logs to help troubleshoot
problems in your application. For more information about WebLogic JDBC Spy, see Tracking JDBC Calls with WebLogic JDBC Spy in Type 4 JDBC
Drivers for Oracle WebLogic Server.