Class.forName issue with variable vs. String

stephanei3

New Member
We have server applications that were successfully loading the jTDS JDBC driver with this syntax:\[code\]Class.forName("net.sourceforge.jtds.jdbc.Driver");\[/code\]We are now changing to a set of application properties that will contain the driver string and this throws a \[code\]ClassNotFoundException\[/code\]:\[code\]String driverFqdn = "net.sourceforge.jtds.jdbc.Driver";Class.forName(driverFqdn);\[/code\]The driver JAR file is in the classpath, even when we are running in Eclipse or NetBeans.This is Java 1.6.Why would \[code\]Class.forName()\[/code\] fail when using a \[code\]String\[/code\] variable?Thanks.Here is the stack trace when we use the String variable:\[code\]java.lang.ClassNotFoundException: "net.sourceforge.jtds.jdbc.Driver" at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.twia.heymon.database.cnnpool.SimpleConnectionPool.getCnn(SimpleConnectionPool.java:67)\[/code\]
 
Back
Top