title: Can't achieve working with p6Spy
body: <p>I've tried two methods for adding p6Spy feature to my spring used project.</p>
  
  <p>Route I,</p>
  
  <p><a href="http://templth.blogspot.com.tr/2004/11/integrate-p6spy-with-spring.html" rel="nofollow">http://templth.blogspot.com.tr/2004/11/integrate-p6spy-with-spring.html</a>
  I changed my driver with <code>com.p6spy.engine.spy.P6SpyDriver</code> and added realdriver  <code>realdriver=com.ibm.db2.jcc.DB2Driver</code> into <code>spy.properties</code> file.</p>
  
  <p>But somehow my realdriver is being registered before p6spy <strong>driver com.ibm.db2.jcc.DB2Driver is a real driver in spy.properties, but it has been loaded before p6spy.  p6spy will not wrap these connections.Either prevent the driver from loading, or try setting 'deregisterdrivers' to true in spy.properties</strong></p>
  
  <p>Using <code>:p6spy:</code> prefix doesn't work for me. It says can't establish connection with that url.</p>
  
  <p>So,I chose setting this <strong><code>deregisterdrivers=true</code></strong> in property file.
  This time I get sql in log file but can't execute sqls. I'm able to execute sql in another sql editor. It seemed real connection went and a dummy one came.</p>
  
  <p>Route II,
  We use spring. So I've tried this method. Giving datasource explicitly to p6Spy. But this time spring complained of multiple java.sql.DataSource instance. Both <code>com.firm.BasicDataFill</code> and <code>com.p6spy.engine.spy.P6DataSource</code> implements DataSource. Spring can't obtain a singleton.</p>
  
  <p><a href="http://templth.blogspot.com.tr/2004/11/integrate-p6spy-with-spring.html" rel="nofollow">http://templth.blogspot.com.tr/2004/11/integrate-p6spy-with-spring.html</a> </p>
  
  <pre><code>&lt;bean id="dataSource" lazy-init="true"
      class="com.firm.BasicDataFill"&gt;
      &lt;property name="driverClassName" value="${database.connection.driver_class}" /&gt;
      &lt;property name="username" value="${database.connection.username}" /&gt;
      &lt;property name="password" value="${database.connection.password}" /&gt;
      &lt;property name="url" value="${database.connection.url}" /&gt;
         ...
      &lt;property name="accessToUnderlyingConnectionAllowed" value="true" /&gt;                                
  &lt;/bean&gt;
  
  &lt;!-- bean id="myDataSource" class="com.p6spy.engine.spy.P6DataSource"&gt;
      &lt;constructor-arg&gt;
          &lt;ref local="dataSource"/&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean--&gt;
  </code></pre>
  
  <p>Finally, I discovered p6spy v1.3 and 2.4.1 settings vary. Do you have any suggestion for a spring based application.</p>