P6Spy Installation
This installation documentation contains instructions for installing P6Spy with various application servers. In addition, it contains general installation instructions for application servers not listed and applications that do not use application servers. Keep in mind that the Unspecified Application Server instructions do not contain details specific to your application server. Use them only as a guideline. If you create instructions for other application servers, send us a copy for possible publication in the documentation.
The installed P6Spy software offers many configuration options. See Common Property File Settings for additional information.
The following instructions were tested with various JBoss versions ranging from JBoss 2.2.2-2.4.4 with Jakarta Tomcat 3.2.2-4.0.1 integration. To install P6Spy on JBoss 2.x, complete the following steps:
Extract the p6spy-install.jar file. The p6spy-install.jar file contains p6spy.jar and spy.properties.- Move the p6spy.jar file to the ext directory. An example of the path to your ext directory is C:/JBoss-2.2.2_Tomcat-3.2.2/jboss/lib/ext.
Move the spy.properties file to the db directory, which is part of the JBoss classpath. An example of the path to your db directory is C:/JBoss-2.2.2_Tomcat-3.2.2/jboss/db.- Modify the jboss.jcml file in the Tomcat conf directory to use the P6Spy driver, by removing your existing driver from the Drivers attribute and replacing it with the P6Spy driver. An example of an edited jboss.jcml file follows:
<mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
<attribute name="Drivers">com.p6spy.engine.spy.P6SpyDriver</attribute>
</mbean>
realdriver = oracle.jdbc.driver.OracleDriver
Installation is complete. When you run your application, a spy.log file is generated in the bin directory of the JBoss server. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
(Contributed by Alan Arvesen, IronGrid)
The following instructions were tested with JBoss 3.0.4 with Jetty integration. For these instructions, P6Spy assumes that you are using the default server residing in JBOSS_DIST/server/default, where JBOSS_DIST is the directory in which JBoss is installed. These instructions are intended for wrapping driver services, not XADataSource services. To install P6Spy on JBoss 3.x, complete the following steps:
Extract the p6spy-install.jar file. The p6spy-install.jar file contains p6spy.jar and spy.properties. Move the p6spy.jar file to the lib directory. An example of the path to your lib directory is C:/java/jboss-3.0.4/server/default/lib. Add spy.properties to your JBoss classpath. By default, the JBoss classpath set up by run.bat only points to tools.jar and run.jar. You may need to add a directory, via JBOSS_CLASSPATH, to this path. An example of an edited JBoss classpath follows:
C:/> set JBOSS_CLASSPATH=C:/java/jboss-3.0.4/server/default/db
C:/> copy C:/java/p6spy/spy.* C:/java/jboss-3.0.4/server/default/db
<attribute name="JndiName">MySqlDS</attribute>
<attribute name="ManagedConnectionFactoryProperties">
<properties>
<config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost/localdb</config-property>
<config-property name="DriverClass"type="java.lang.String">com.p6spy.engine.spy.P6SpyDriver</config-property>Note: Make sure there is not a service that explicitly loads the wrapped driver. A service of this type will load the specified driver before P6SpyDriver, resulting in unwrapped connections.
realdriver=org.gjt.mm.mysql.Driver
Installation is complete. When you run your application, a log file (spy.log) is generated in the bin directory of the JBoss server. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
The following instructions were tested with Orion. To install P6Spy on Orion, complete the following steps:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="Hypersonic"
location="jdbc/HypersonicCoreDS"
xa-location="jdbc/xa/HypersonicXADS"
ejb-location="jdbc/HypersonicDS"
connection-driver="com.p6spy.engine.spy.P6SpyDriver"
username="sa"
password=""
url="jdbc:HypersonicSQL:./database/defaultdb"
inactivity-timeout="30"
/>
java -Dp6.home=c:/orion/orion/lib -jar orion.jar
Installation is complete. When you run your application, a log file (spy.log) is generated in the orion-home directory of the Orion server. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
The following instructions were tested with Jakarta Tomcat 3.x. Note that since you typically write or otherwise obtain your own Connection Pool when using Tomcat, these instructions will differ by application. To install P6Spy on Jakarta Tomcat, complete the following steps:
<init-param><param-name>databaseDriver</param-name><param-value>org.gjt.mm.mysql.Driver</param-value></init-param>
In this above case, the databaseDriver parameter has a value of org.gjt.mm.mysql.Driver, which is the MySQL™ driver. Wherever this configuration information is stored, change the driver name (org.gjt.mm.mysql.Driver, in our example) to com.p6spy.engine.spy.P6SpyDriver, as in the following example:
<init-param><param-name>databaseDriver</param-name><param-value>com.p6spy.engine.spy.P6SpyDriver</param-value></init-param>
SET TOMCAT_OPTS=-Dp6.home=C:/jakarta-tomcat-3.2.1/webapps/p6/WEB-INF/lib
realdriver = org.gjt.mm.mysql.Driver
Installation is complete. When you run your application, a log file (spy.log) is generated in the directory from which you launched the application. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
(Contributed by François Exertier, JOnAS Opensource EJB Server team)
The following instructions were tested with JOnAS 2.3.x. To install P6Spy on JOnAS EJB, complete the following steps:
datasource.name jdbc_1
datasource.description "Standard jdbc driver for Oracle"
datasource.url jdbc:oracle:thin:scott/tiger@maltes:1521:ORA1
datasource.classname com.p6spy.engine.spy.P6SpyDriver
...
Note: Database access configuration within JOnAS is described in a DataSource property file, such as Oracle1.properties. Refer to the JOnAS Bean Programmer's Guide for more details.
realdriver = oracle.jdbc.driver.OracleDriver
The following sections contain specific information on installing P6Spy on BEA WebLogic Portal 4.0, BEA WebLogic Server 6.1, and BEA WebLogic 5.1.
Note: IBM™ Cloudscape does not work with P6Spy and BEA WebLogic. However, Cloudscape does work with P6Spy when using the J2EE reference implementation server. The following suggestion was submitted by Adrian Fletcher: "I may be wrong but I suspect the problem with Cloudscape and WebLogic is that both drivers end up registered against the same URL. I seem to remember that the best trick for avoiding this is mangling the URL. If you instruct users to prepend "p6spy:" to their URL and then remove it in your wrapped file, it should work in more cases." You can do this with the useprefix option. If anyone has an opportunity to validate this, please drop us a line with updated information.
(Contributed by Philip Ogren, BEA)
The following instructions were tested with WebLogic Server 6.1 Service Pack 2 with WebLogic Portal 4.0 Service Pack 1 running on Microsoft® Windows® using the following:
WebLogic jDriver for Oracle® Oracle Thin driver for 8.1.7 WebLogic jDriver for Microsoft SQL Server™ Sybase™ jConnect-5_2 driverThe default Stockportal (Avitek) application is used in this example. To install P6Spy on BEA WebLogic Portal, complete the following steps:
Extract the p6spy-install.jar file to a temporary directory. The p6spy-install.jar file contains the files p6spy.jar and spy.properties. Move p6spy.jar to bea-home/wlportal4.0/lib/ext, where bea-home is the directory in which BEA WebLogic is installed.- Add ;%P13N_DIR%/lib/ext/p6spy.jar to EXT_CLASSPATH in the set-environment.bat file. set-environment.bat resides in bea-home/wlportal4.0/bin/win32. Do not include any trailing spaces after the new line.
- Move spy.properties to bea-home/wlportal4.0/config/portalDomain or to the application's domain directory.
- Modify the realdriver line in the spy.properties file to reflect your wrapped database driver. An example of a modified realdriver line follows:
realdriver=weblogic.jdbc.oci.Driver
- Add ;%P13N_DIR%/config/portalDomain to the classpath in the startPortal.bat file. The path to startPortal.bat is bea-home/wlportal4.0/config/portalDomain. Do not include any trailing spaces after the new line.
- Modify WebLogic Portal to use the P6Spy driver. Either modify config.xml (which resides in bea-home/wlportal4.0/config/portalDomain) directly or complete the following steps:
- Start WebLogic Portal by running startPortal.bat.
- Start the Administration Console tool by navigating to http://your-host:7501/console, where your-host is the machine on which BEA WebLogic is installed.
- Navigate to the your-domain (where your-domain is the domain name specified during the BEA WebLogic install) -> Services -> JDBC -> Connection Pools node and set the Driver Classname for each Connection Pool to com.p6spy.engine.spy.P6SpyDriver.
- If using RDBMS Security Realm, configure P6Spy to monitor your realms (in this example, commercePool, dataSyncPool, and wlcsRealm) by completing the following steps:
- Using the Administration Console, navigate to the your-domain -> Security -> Realms node.
- Select the security realm.
- Click the Database tab.
- Set the Driver parameter to com.p6spy.engine.spy.P6SpyDriver.
- Using the Administration Console, shut down WebLogic Portal. Right-click on the your-domain->Servers->your-server node and select Stop this Server from the pop-up menu.
- Restart WebLogic Portal by running startPortal.bat.
Installation is complete. When you run your application, a log file (spy.log) is generated in bea-home/wlportal4.0. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
(Contributed by Philip Ogren, BEA)
The following instructions were tested with WebLogic Server 6.1 Service Pack 2 with WebLogic Portal 4.0 Service Pack 1 running on Microsoft Windows using the following:
WebLogic jDriver for Oracle Oracle Thin driver for 8.1.7 WebLogic jDriver for Microsoft SQL Server Sybase jConnect-5_2 driveTo install P6Spy on BEA WebLogic Server, complete the following steps:
Extract the p6spy-install.jar file to a temporary directory. The p6spy-install.jar file contains the files p6spy.jar and spy.properties. Move p6spy.jar to bea-home/wlserver6.1/lib/ext, where bea-home is the directory in which BEA WebLogic is installed.- Move spy.properties to bea-home/wlserver6.1/config/your-domain, where your-domain is the domain name specified during the BEA WebLogic install.
- Modify the realdriver line in the spy.properties file to reflect your wrapped database driver. An example of a modified realdriver line follows:
realdriver=weblogic.jdbc.oci.Driver
- Add ;./lib/ext/p6spy.jar;./config/your-domain to the classpath in the startWebLogic.cmd file. startWebLogic.cmd resides in bea-home/wlserver6.1/config/your-domain. Do not include any trailing spaces after the new line. This adds p6spy.jar and spy.properties to the classpath.
- Modify WebLogic Server to use the P6Spy driver. Either modify config.xml (which resides in bea-home/wlserver6.1/config/your-domain) directly or complete the following steps:
- Start WebLogic Server by running startWebLogic.cmd.
- Start the Administration Console tool by navigating to http://<your-host>:7501/console.
- Navigate to the your-domain -> Services -> JDBC -> Connection Pools node and set the Driver Classname for each Connection Pool to com.p6spy.engine.spy.P6SpyDriver.
- If using RDBMS Security Realm, configure P6Spy to to monitor your realms (in this example, commercePool, dataSyncPool, and wlcsRealm) by completing the following steps:
- Using the Administration Console, navigate to the your-domain -> Security -> Realms node.
- Select the security realm.
- Click the Database tab.
- Set the Driver parameter to com.p6spy.engine.spy.P6SpyDriver.
- Using the Administration Console, shut down WebLogic Server. Right-click on the your-domain -> Servers -> your-server node and select Stop this Server from the pop-up menu.
- Restart WebLogic Portal by running startWebLogic.cmd.
Installation is complete. When you run your application, a log file (spy.log) is generated in bea-home/wlserver6.1. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
(Contributed by Richard Delbert)
The following instructions were tested with WebLogic 5.1. To install P6Spy on BEA WebLogic, complete the following steps:
Extract the p6spy-install.jar file. The p6spy-install.jar file contains p6spy.jar and spy.properties. Edit startWeblogic.sh, by putting p6spy.jar in the JAVA_CLASSPATH. Edit startWeblogic.sh, by putting spy.properties in the JAVA_CLASSPATH. Edit weblogic.properties (Connection Pool), by replacing the JDBC class driver with com.p6spy.engine.spy.P6SpyDriver. Modify the realdriver line in the spy.properties file to reflect your wrapped database driver. An example of a modified realdriver line follows:
realdriver = oracle.jdbc.driver.OracleDriverInstallation is complete. When you run your application, a log file (spy.log) is generated in the WebLogic home directory. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
The following instructions were tested with ATG Dynamo 5.1. To install P6Spy on ATG Dynamo, complete the following steps:
Note: The default user/pass is admin/admin.
realdriver = oracle.jdbc.driver.OracleDriver
Change this to reflect your database. An example of a modified realdriver line for ATG demo follows:
realdriver = solid.jdbc.SolidDriver
An example setup follows:
URL: jdbc:solid://localhost:1313
driver: com.p6spy.engine.spy.P6SpyDriver
database:
server: localhost:1313
server name:
user name: admin
password: admin
confirm password: admin
Installation is complete. When you run your application, a log file (spy.log) is generated in the C:/ATG/Dynamo5.1/home directory. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
(Contributed by Michael Sgroi)
The following instructions were tested with Sun iPlanet 6.0 Service Pack 3 and should work for any release of iPlanet 6.0. To install P6Spy on iPlanet, complete the following steps:
Driver Identifier: spy
Driver Classname: com.p6spy.engine.spy.P6SpyDriver
Driver Classpath: spy-home/p6spy.jar
iasdeploy regdatasource -user iPlanet_admin_username -password iPlanet_admin_password -host localhost -port iPlanet_admin _port config_filename
where iPlanet_admin_username is your iPlanet admin username, iPlanet_admin_password is your iPlanet admin password, iPlanet_admin_port is the iPlanet admin port number, and config_filename is the full path to the file containing your DataSource configuration. An example follows:
<ias-resource>
<resource>
<jndi-name>jdbc/yourapp/ora-type4-spy</jndi-name>
<jdbc>
<driver-type>spy</driver-type>
<database-url>jdbc:oracle:thin:@localhost:1521:orcl</database-url>
<username>user</username>
<password>password</password>
</jdbc>
</resource>
</ias-resource>
(For more details on parameters passed to iasdeploy and the format of config_filename, refer to the iPlanet documentation.)
Installation is complete. When you run your application, a spy.log file is generated. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
The following instructions were tested with IBM WebSphere 4.0.
Note: Before installing, make sure your JDBC driver is configured in your target application server as a DataSource.
To install P6Spy on IBM WebSphere, complete the following steps:
DatabaseName
Default User
Default Password
port 3306
serverName myhost
Server Class Path = path_to_p6spy.jar
Name = P6SpyDriver
Description = P6Spy JDBC tracing driver
Implementation Classname = com.p6spy.engine.spy.P6ConnectionPoolDataSource
realdatasource=RealMySqlDS
prealdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSourcerealdatasourceproperties=port;3306,serverName;myhost
Note: The items in realdatasourceproperties are the items that you recorded from the Driver Specific properties in your original DataSource configuration.
realdriver=com.mysql.Driver
Installation is complete. When you run your application, a spy.log file is generated. The log file contains a list of all of the database statements executed. You can change both the destination of spy.log and what it logs by editing the spy.properties file (see Common Property File Settings).
(Contributed by Hadi Nahari, RadonSoft)
The following instructions were tested with Resin 2.1.x. Note that since you typically write or otherwise obtain your own Connection Pool when using Resin, these instructions will differ by application. To install P6Spy on Resin, complete the following steps:
<init-param>
<param-name>db.driver</param-name>
<!-- mysql (mm driver) -->
<param-value>org.gjt.mm.mysql.Driver</param-value>
</init-param>
In the above case, the db.driver parameter has a value of org.gjt.mm.mysql.Driver, which is the MySQL driver. Wherever this configuration information is stored, change the driver name (org.gjt.mm.mysql.Driver, in our example) to com.p6spy.engine.spy.P6SpyDriver, as in the following example:
<init-param>
<param-name>db.driver</param-name>
<!-- mysql (mm driver) -->
<param-value>com.p6spy.engine.spy.P6SpyDriver</param-value>
</init-param>
realdriver = org.gjt.mm.mysql.Driver
C:/resin-2.1.6/bin/httpd
- -Dp6.home=C:/resin-2.1.6/webapps/your_app_name/WEB-INF/lib
The following installation instructions are intended for use with application servers not listed above and applications that do not use application servers. To install P6Spy, complete the following steps:
CLASSPATH=c:/p6spy/p6spy.jar
Note: If you are using an EJB server, adding the p6spy.jar file to your classpath may not work. Some EJB servers ignore the classpath, setting their own on startup.
realdriver = oracle.jdbc.driver.OracleDriver