• 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

how to get Driver location from datasource at runtime?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I want to find the location from where a driver class is loaded. Assuming I only have the datasource, and the driver class name.

Is that posible? have you any idea about how to get that?

Thank You

I'm running in jboss
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cesar,
Welcome to JavaRanch!

It can be done by getting the classpath, looping through it and listing the classes in each jar. However, it is suspect. What are you trying to accomplish with the driver location? Why can't you just pass it in?
 
Cexar Flores
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne,

Well I know the path of the class beforehand, I just having an issue with the driver and wanted to make sure the driver is taken from supposed and not from other place maybe. For example in jboss you can put driver 1 in %JBOSS_HOME%/server/default/lib, but if the .ear has its own driver 2, then I want to know what driver is being loaded by classloader.

That's why I was trying to determine how to find what driver is being loaded, at run time.

BTW, is this topic in the correct saloon?, should this be moved to JDBC or JBOSS saloons?

-Cesar Flores
 
Who among you feels worthy enough to be my best friend? Test 1 is to 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