Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get Driver location from datasource at runtime?  RSS feed

 
Cexar Flores
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!