This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm trying to use a jdbc-driver in a quite dynamic way, which means, that at application start, neither the jarfile of the driver is part of the classpath, nor the classname of the driver is known.
The loading of the jar, the classpath extension and initializing of the driver works so far.
But when I try to use that driver, I get an SQL-Exception complaining that no usable driver can be found for the url.
So I added a LogWriter to the DriverManager and I got the message, that the DriverManager is skipping my loaded driver.
My code is this:
Geronimo M. Hernandez wrote:The loading of the jar, the classpath extension and initializing of the driver works so far
Are you sure?
How do you load the jar?
Geronimo M. Hernandez
Joined: Mar 16, 2009
thanks for your attention.
Are you sure?
If you look at the provided code snippets, you'll see, that the query of the DriverManager will be performed only if the creation of the Driver-instance was successful.
Meanwhile I got it and it works.
The DriverManager was the problem. I think, the so-called "security-question" (which I don't really understand) is anything else but security, so I wrote a replacement for the DriverManager and now the dynamic driver loading works as expected.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: need help on dynamic loading of jdbc driver