P6Spy is a framework that enables database data to be seamlessly intercepted and manipulated with no code changes to existing application.
It's easy to replace jdbc driver with p6spy in GlassFish (I've tried in GlassFish 2.1.1), just few steps:
1. Make sure you have a workable jdbc resource with workable jdbc pool.
you can use ping to verify if your resource's setting is correctly. likes this
2. Put p6spy.jar and spy.properties in GlassFish's class path.
e.g., I've put those files in C:\Sun\AppServer\p6spy\, and config GlassFish's Classpath Prefix like below:
3. Config spy.properties
At least those 3 properties need to be done:
I: realdriver, e.g., realdriver=oracle.jdbc.OracleDriver
II: realdatasource, fill in your workable jdbc resource name here, e.g., jdbc/workable_jdbc
III: realdatasourceclass, fill in the real datasource class name here. e.g., oracle.jdbc.pool.OracleDataSource
4. Create a new connection pool.
Datasource Classname: com.p6spy.engine.spy.P6DataSource
Resource Type: javax.sql.DataSource
Add 2 properties : user / password. You can fill anything you want in Value field(cause it'll relay the realdatasource property in spy.properties.), but don't left blank
5. Create a new jdbc resource
fill in JNDI Name, e.g., jdbc/spy
select Pool name which created by step4. e.g., p6spy
沒有留言:
張貼留言