• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAMon and DataSources

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone know if JAMon currently works with DataSources? The documentation has examples using the DriverManager and my few attempts translate this to a DataSource definition in JBoss have not worked. Anyone done this?
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately I never fully incorporated DataSources into the code. However, there is a wrapper for DataSources that will monitor them if you can provide a utility method like the following in your code and pass your data source through it. Optionally if you have a utility that has a 'Connection getConnection()' method you could do something similar for the Connection itself.




Here is a link to the JAMonDataSource class.

http://jamonapi.cvs.sourceforge.net/viewvc/jamonapi/jamonapi/src/java/com/jamonapi/proxy/JAMonDataSource.java?revision=1.1&view=markup

 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about the delay in responding by the way. If there is ever an urgent jamon question it is best to post it on the jamon support forum at sourceforge as it notifies me with an email that someone has a question.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK Steve, thanks. I'll have a play with the wrapper.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alternatively you can monitor any connection (whether returned from a datasource or some other way) in the following manner. If you have a class that manages your connections that should be easy to add.

 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A little late for you maybe, but here is the info on how to use jamon with DataSources. I tested it with mysql on tomcat. The only file you need to change is context.xml which can either reside in your web app in META-INF/context.xml or in the tomcat conf/context.xml file. context.xml is the only file you will need to change by putting in your own connection info (no changes need to be made to web.xml or server.xml).

One gotcha is that the context.xml file is also often copied into one of the tomcat directories (on my computer conf/Catalina/localhost/appname.xml). Delete this file if you change any info in the context.xml files. If you don't then the server may not see your changes and will be using the old file.


The attached context.xml defines 2 dataSources that use JAMon.

 
We can walk to school together. And we can both read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic