I have a plugin that connects to database. I don't want to bundle the jar for the driver in my plugin. Instead i want to take it from the users project and load it in run-time. Below is the code I am using to achieve the same. I get the error "No suitable driver found......" from line 3. The same line works fine when i use Class.forName("com.mysql.jdbc.Driver"); and include the jar in my plugin. Please point out what could be wrong.
/*urls = [file:/C:/veni/code/TestFC/lib/mysql-connector-java-5.1.15-bin.jar] */
final ClassLoader loader = new URLClassLoader(urls); //1
loader.loadClass("com.mysql.jdbc.Driver"); //2
con = DriverManager.getConnection("jdbc:mysql://localhost/testfc",username,paswd); //3