You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Daniel Perry <d....@netcase.co.uk> on 2004/12/07 18:34:46 UTC

p6spy

Simple question - how do i use p6spy?

I've recompiiled ojb with p6spy, and set mysql as the 'real' driver.  I've
copied the jar file and p6spy's jar.

I've changed my repository to use p6spy (see below), and added the driver:

    <jdbc-connection-descriptor
        jcd-alias="default"
        default-connection="true"
        platform="MySQL"
        jdbc-level="2.0"
        driver="com.p6spy.engine.spy.P6SpyDriver"
        protocol="jdbc"
        subprotocol="mysql"
        dbalias="//localhost/lecrossingpdp"
        username=""
        password=""
        batch-mode="false"
   >

But i get the error:
[org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
Error getting Connection from DriverManager with url
(jdbc:mysql://localhost/lecrossingpdp) and driver
(com.p6spy.engine.spy.P6SpyDriver)
No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectio
nFromDriverManager(ConnectionFactoryAbstractImpl.java:253)
at
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConPoolFactory
.makeObject(ConnectionFactoryPooledImpl.java:231)
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPoo
l.java:816)
.......


Any ideas?
What have i missd?

Thanks,
Daniel.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: p6spy

Posted by Thomas Dudziak <to...@first.fhg.de>.
Daniel Perry wrote:

> I've found p6spy very useful over the last couple of days. However, it took
> a bit of encouragement to get it working!
> 
> I think the FAQ is a bit misleading. 

Agreed.

> It says:
> "In the file build.properties you have to set the switch useP6Spy to true in
> order to activate it:"
> 
> Which implies that you need to rebuild ojb to use it. On inspecting
> build.xml it seems that this is only for the unit tests.  I think the FAQ
> should be more along the lines of:
> 
> To add it to any project, you need to:
> copy lib/p6spy.jar to your classpath.
> 
> copy spy.properties from src/test/org/apache/ojb/ to your classpath.
> 
> edit spy.properties, and:
>     if not using hsqldb, comment it out
>         #realdriver=org.hsqldb.jdbcDriver
>     and uncomment the appropriate realdriver for your database.
>     If you want it to log to a different file/path then edit:
>         logfile     = spy.log
>     If you want to log to stdout instead, then comment out the filelogger,
> and uncomment stdoutlogger:
>         appender=com.p6spy.engine.logging.appender.StdoutLogger
>         #appender=com.p6spy.engine.logging.appender.FileLogger
> 
> p6spy is now installed, but to enable it, edit your repository_database.xml
> and change your database driver to:
>     driver="com.p6spy.engine.spy.P6SpyDriver"
> If you want to disable it, just change your driver back to whatever you are
> using eg:
> driver="com.mysql.jdbc.Driver"
> Note that you dont have to change any of the other properties eg, platform,
> subprotocol, etc.
> 
> Hope that is of help to someone,

I will update the FAQ.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: p6spy

Posted by Daniel Perry <d....@netcase.co.uk>.
I've found p6spy very useful over the last couple of days. However, it took
a bit of encouragement to get it working!

I think the FAQ is a bit misleading.  It says:
"In the file build.properties you have to set the switch useP6Spy to true in
order to activate it:"

Which implies that you need to rebuild ojb to use it. On inspecting
build.xml it seems that this is only for the unit tests.  I think the FAQ
should be more along the lines of:

To add it to any project, you need to:
copy lib/p6spy.jar to your classpath.

copy spy.properties from src/test/org/apache/ojb/ to your classpath.

edit spy.properties, and:
    if not using hsqldb, comment it out
        #realdriver=org.hsqldb.jdbcDriver
    and uncomment the appropriate realdriver for your database.
    If you want it to log to a different file/path then edit:
        logfile     = spy.log
    If you want to log to stdout instead, then comment out the filelogger,
and uncomment stdoutlogger:
        appender=com.p6spy.engine.logging.appender.StdoutLogger
        #appender=com.p6spy.engine.logging.appender.FileLogger

p6spy is now installed, but to enable it, edit your repository_database.xml
and change your database driver to:
    driver="com.p6spy.engine.spy.P6SpyDriver"
If you want to disable it, just change your driver back to whatever you are
using eg:
driver="com.mysql.jdbc.Driver"
Note that you dont have to change any of the other properties eg, platform,
subprotocol, etc.

Hope that is of help to someone,

Daniel.

> -----Original Message-----
> From: Daniel Perry [mailto:d.perry@netcase.co.uk]
> Sent: 08 December 2004 10:32
> To: OJB Users List
> Subject: RE: p6spy
>
>
> Well, i added:
> com.mysql.jdbc.Driver a = new com.mysql.jdbc.Driver();
> com.p6spy.engine.spy.P6SpyDriver b = new
> com.p6spy.engine.spy.P6SpyDriver();
>
> Just to verify that it was all there, and it came up with a different
> error - couldnt find spy.properties in the classpath!
>
> Copied that accross, and it seems to be working.  In the faq i found it
> doesnt mention that you need to copy this file into the classpath!
>
> Daniel.
>
>
>
> > -----Original Message-----
> > From: Armin Waibel [mailto:arminw@apache.org]
> > Sent: 07 December 2004 19:28
> > To: OJB Users List
> > Subject: Re: p6spy
> >
> >
> > Daniel Perry wrote:
> > > Simple question - how do i use p6spy?
> > >
> > > I've recompiiled ojb with p6spy, and set mysql as the 'real'
> > driver.  I've
> > > copied the jar file and p6spy's jar.
> > >
> >
> > p6spy, mysql driver jar really in classpath, typo in realdriver
> property?
> > Sorry, that's all cross my my mind ;-)
> >
> > Armin
> >
> >
> > > I've changed my repository to use p6spy (see below), and added
> > the driver:
> > >
> > >     <jdbc-connection-descriptor
> > >         jcd-alias="default"
> > >         default-connection="true"
> > >         platform="MySQL"
> > >         jdbc-level="2.0"
> > >         driver="com.p6spy.engine.spy.P6SpyDriver"
> > >         protocol="jdbc"
> > >         subprotocol="mysql"
> > >         dbalias="//localhost/lecrossingpdp"
> > >         username=""
> > >         password=""
> > >         batch-mode="false"
> > >    >
> > >
> > > But i get the error:
> > >
> [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
> > > Error getting Connection from DriverManager with url
> > > (jdbc:mysql://localhost/lecrossingpdp) and driver
> > > (com.p6spy.engine.spy.P6SpyDriver)
> > > No suitable driver
> > > java.sql.SQLException: No suitable driver
> > > at java.sql.DriverManager.getConnection(Unknown Source)
> > > at java.sql.DriverManager.getConnection(Unknown Source)
> > > at
> > >
> > org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.ne
> > wConnectio
> > > nFromDriverManager(ConnectionFactoryAbstractImpl.java:253)
> > > at
> > >
> > org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConP
> > oolFactory
> > > .makeObject(ConnectionFactoryPooledImpl.java:231)
> > > at
> > >
> > org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Generi
> > cObjectPoo
> > > l.java:816)
> > > .......
> > >
> > >
> > > Any ideas?
> > > What have i missd?
> > >
> > > Thanks,
> > > Daniel.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail: ojb-user-help@db.apache.org
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: p6spy

Posted by Daniel Perry <d....@netcase.co.uk>.
Well, i added:
com.mysql.jdbc.Driver a = new com.mysql.jdbc.Driver();
com.p6spy.engine.spy.P6SpyDriver b = new com.p6spy.engine.spy.P6SpyDriver();

Just to verify that it was all there, and it came up with a different
error - couldnt find spy.properties in the classpath!

Copied that accross, and it seems to be working.  In the faq i found it
doesnt mention that you need to copy this file into the classpath!

Daniel.



> -----Original Message-----
> From: Armin Waibel [mailto:arminw@apache.org]
> Sent: 07 December 2004 19:28
> To: OJB Users List
> Subject: Re: p6spy
>
>
> Daniel Perry wrote:
> > Simple question - how do i use p6spy?
> >
> > I've recompiiled ojb with p6spy, and set mysql as the 'real'
> driver.  I've
> > copied the jar file and p6spy's jar.
> >
>
> p6spy, mysql driver jar really in classpath, typo in realdriver property?
> Sorry, that's all cross my my mind ;-)
>
> Armin
>
>
> > I've changed my repository to use p6spy (see below), and added
> the driver:
> >
> >     <jdbc-connection-descriptor
> >         jcd-alias="default"
> >         default-connection="true"
> >         platform="MySQL"
> >         jdbc-level="2.0"
> >         driver="com.p6spy.engine.spy.P6SpyDriver"
> >         protocol="jdbc"
> >         subprotocol="mysql"
> >         dbalias="//localhost/lecrossingpdp"
> >         username=""
> >         password=""
> >         batch-mode="false"
> >    >
> >
> > But i get the error:
> > [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
> > Error getting Connection from DriverManager with url
> > (jdbc:mysql://localhost/lecrossingpdp) and driver
> > (com.p6spy.engine.spy.P6SpyDriver)
> > No suitable driver
> > java.sql.SQLException: No suitable driver
> > at java.sql.DriverManager.getConnection(Unknown Source)
> > at java.sql.DriverManager.getConnection(Unknown Source)
> > at
> >
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.ne
> wConnectio
> > nFromDriverManager(ConnectionFactoryAbstractImpl.java:253)
> > at
> >
> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConP
> oolFactory
> > .makeObject(ConnectionFactoryPooledImpl.java:231)
> > at
> >
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Generi
> cObjectPoo
> > l.java:816)
> > .......
> >
> >
> > Any ideas?
> > What have i missd?
> >
> > Thanks,
> > Daniel.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: p6spy

Posted by Armin Waibel <ar...@apache.org>.
Daniel Perry wrote:
> Simple question - how do i use p6spy?
> 
> I've recompiiled ojb with p6spy, and set mysql as the 'real' driver.  I've
> copied the jar file and p6spy's jar.
>

p6spy, mysql driver jar really in classpath, typo in realdriver property?
Sorry, that's all cross my my mind ;-)

Armin


> I've changed my repository to use p6spy (see below), and added the driver:
> 
>     <jdbc-connection-descriptor
>         jcd-alias="default"
>         default-connection="true"
>         platform="MySQL"
>         jdbc-level="2.0"
>         driver="com.p6spy.engine.spy.P6SpyDriver"
>         protocol="jdbc"
>         subprotocol="mysql"
>         dbalias="//localhost/lecrossingpdp"
>         username=""
>         password=""
>         batch-mode="false"
>    >
> 
> But i get the error:
> [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
> Error getting Connection from DriverManager with url
> (jdbc:mysql://localhost/lecrossingpdp) and driver
> (com.p6spy.engine.spy.P6SpyDriver)
> No suitable driver
> java.sql.SQLException: No suitable driver
> at java.sql.DriverManager.getConnection(Unknown Source)
> at java.sql.DriverManager.getConnection(Unknown Source)
> at
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectio
> nFromDriverManager(ConnectionFactoryAbstractImpl.java:253)
> at
> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConPoolFactory
> .makeObject(ConnectionFactoryPooledImpl.java:231)
> at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPoo
> l.java:816)
> .......
> 
> 
> Any ideas?
> What have i missd?
> 
> Thanks,
> Daniel.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org