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:
Can anybody give me a helping hand about what to do, to successfully load a jdbc-driver at runtime?
Joined: Mar 03, 2008
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.