Hi!
I'm trying to load driver by reflection like this,
try {
URL ora8libURL = new URL("file:///C:/oracle/product/10.2.0/clientDev/jdbc/lib/classes12.jar");
Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora8libURL}));
Enumeration<Driver> drivers = DriverManager.getDrivers();
while(drivers.hasMoreElements())
{
Driver drv = drivers.nextElement();
System.out.println(drv.getClass().getName());
}
conn = DriverManager.getConnection("jdbc:oracle:thin:@//192.168.186.13:1521/rdb817","user","password");
}
catch(ClassNotFoundException ex) {ex.printStackTrace();}
catch(MalformedURLException ex) {ex.printStackTrace();}
catch (SQLException ex) {ex.printStackTrace();}
but i've got this error:
sun.jdbc.odbc.JdbcOdbcDriver
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//192.168.186.13:1521/rdb817
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
...
However, when i specify driver explicit in classpath it works fine.
Help.