This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting classpath to test connection to database

 
Sunil Aggarwal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to the following:

1. Test connection to a database/datasource using the classpath specified by the user. The classpath will be an absolute path like c:\...where the jar will be located.

I have the some question regarding that:

a. I can't set classpath at runtime, can i?
b. How can I load jars at runtime to test connection and hence load the driver class?
c. Is it possible to set the classpath temporarily with the one given by user? I guess using command line "set classpath" will not help, right?
d. URLClassloader allows loading of jars but it accepts a URL as an argument and i assume i cant specify a location like "C:\.." in the URL.
Am i right?

Please help. Any quick suggestions would be highly appreciated.

Thanka and Regards.
 
Yilmaz Mete
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding d) you can of course define a file , wrap it in a URL.

But what are you trying to achieve in general? sort of ambiguous.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic