Extensions to the listening

Ian Meyers
2003-10-10
2003-10-10
  • Ian Meyers
    Ian Meyers
    2003-10-10

    Hi,

    Wondering if there would be a way that I could force P6Spy to do something of my choice just after creating the jdbc connection to the database. Namely, I'd like to be able to insert a class method which should be run just after the connection is opened. This would use the just opened connection to call DBMS_APPLICATION_INFO on oracle to include connection origination information in V$SESSION. Is there any way to do this?

    Thanks in advance.

     
    • Jeff Goke
      Jeff Goke
      2003-10-10

      defiinitely.  p6spy is actually a framework that makes it easy to build your own interception modules.  if you download the source there is an example class that shows you how to go about the process.  it is really easy, you basically are going to create your own module, call it "mymodule", just override the JDBC classes you want to change, and just the methods you want to change.  it would just take a few minutes.

      the other thing to understand is that p6spy modules are stackable.  for you this is cool because it means your module will just override the classes you care about and you'll active it by listing it first in spy.properties.  however, if you leave the standard spy module in place, the system will automatically execute the standard logging code while still performing the code you've written.  that is, you don't have to touch the existing modules, you can just create your own and stick it in front of the standard modules, and you are done!

      -jeff

       
      • Ian Meyers
        Ian Meyers
        2003-10-10

        Thanks Jeff - will have a crack at it then. Seems promising for us!