You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by to...@apache.org on 2004/12/10 01:23:32 UTC
cvs commit: db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu faq.xml
tomdz 2004/12/09 16:23:32
Modified: src/doc/forrest/src/documentation/content/xdocs Tag:
OJB_1_0_RELEASE site.xml
src/doc/forrest/src/documentation/content/xdocs/docu Tag:
OJB_1_0_RELEASE faq.xml
Log:
Updated FAQ entry on P6Spy with info from Daniel Perry
Revision Changes Path
No revision
No revision
1.3.2.5 +2 -1 db-ojb/src/doc/forrest/src/documentation/content/xdocs/site.xml
Index: site.xml
===================================================================
RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/site.xml,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -u -r1.3.2.4 -r1.3.2.5
--- site.xml 4 Dec 2004 12:08:16 -0000 1.3.2.4
+++ site.xml 10 Dec 2004 00:23:32 -0000 1.3.2.5
@@ -319,5 +319,6 @@
<nees href="http://www.nees.org/"/>
<ojb-net href="http://ojb-net.sourceforge.net/"/>
<yourkit href="http://www.yourkit.com/" />
+ <p6spy href="http://www.p6spy.com/"/>
</external-refs>
</site>
No revision
No revision
1.1.2.2 +46 -21 db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- faq.xml 27 Jul 2004 00:29:31 -0000 1.1.2.1
+++ faq.xml 10 Dec 2004 00:23:32 -0000 1.1.2.2
@@ -783,30 +783,55 @@
</question>
<answer>
<p>
- OJB ships with out of the box support for P6Spy.
- P6Spy is a JDBC proxy. It delegates all JDBC calls to the
+ OJB ships with out of the box support for <link href="ext:p6spy">P6Spy</link>.
+ P6Spy is a JDBC proxy which delegates all JDBC calls to the
real JDBC driver and traces all calls to a log file.
</p>
<p>
- In the file
- <code>build.properties</code> you have to set the switch
- <code>useP6Spy</code> to
- <code>true</code> in order to activate it:
- </p>
- <source>
-# The useP6Spy switch determines if the tracing JDBC driver P6Spy
-# is used.
-# If you enable this switch, you must also edit the file
-# jakarta-ojb/src/test/org/apache/ojb/spy.properties
-# to tell P6Spy which JDBC driver to use and where to write the log.
-# By default the HSQLDB driver is used.
-useP6Spy=true
- </source>
- <p>
- This setup uses P6Spy to trace and profile all executed
- SQL to a file
- <code>target/test/ojb/spy.log</code>.
- It also measures the time needed to execute each statement!
+ P6Spy is contained in the p6spy.jar, which you'll find in the <code>lib</code>
+ folder of your OJB distribution. Add this to the classpath of your app
+ (if you're using the <link href="site:documentation/getting-started">ojb-blank</link>
+ project, then simply copy the jar into the <code>lib</code> folder of the project
+ and if you're using Eclipse then also add it to the project build path).
+ </p>
+ <p>
+ Now the only other thing left is to configure OJB to use P6Spy, and P6Spy to
+ use your database's driver. To achieve this, change the database driver in
+ your <code>jdbc-connection-descriptor</code> (in your repository file) to
+ </p>
+ <source><![CDATA[
+<jdbc-connection-descriptor
+ ...
+ driver="com.p6spy.engine.spy.P6SpyDriver"
+ ...
+ />]]></source>
+ <p>
+ In <code>ojb-blank</code> this setting is changed in the <code>build.properties</code> instead.
+ </p>
+ <p>
+ Also copy the file <code>spy.properties</code> which can be found in the
+ <code>src/test/org/apache/ojb</code> folder into your classpath (e.g. in the same
+ place where your <code>OJB.properties</code> file is). In this file you'll find a line
+ starting with <code>realdriver</code> where you should put the name of the jdbc driver of
+ your database, e.g.
+ </p>
+ <source>realdriver=org.hsqldb.jdbcDriver</source>
+ <p>
+ Also, here you can influence to where P6Spy will output the SQL statements. The appender
+ defines how the logging is performed, e.g. to the console or to a file. The
+ <code>logfile</code> setting defines into which file the statements will be printed
+ (when a file appender is used). For instance, these settings will write to a file
+ <code>spy.log</code>:
+ </p>
+ <source><![CDATA[
+logfile = spy.log
+appender = com.p6spy.engine.logging.appender.FileLogger
+
+# This would be logging to the console
+#appender = com.p6spy.engine.logging.appender.StdoutLogger]]></source>
+ <p>
+ That's all there is to it, no recompile or other change of your app is necessary.
+ Btw, P6Spy also measures the time needed to execute each statement!
</p>
</answer>
</faq>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org