Add the library in the project build path.
- Right click on project
- Build Path
- Go to Libraries Tab
- Add external jar (ODBC jar) there
Domanda
I'm trying to connect Oracle database using this tutorial. It is working when I use command line: java -cp c:\jdbc-test\ojdbc6.jar;c:\jdbc-test OracleJDBC I have put ojdbc6.jar in the same folder with OracleJDBC.java. Now I need to run it on Eclipse, but it gives me an error:
Output: *Where is your Oracle JDBC Driver?
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at OracleJDBC.main(OracleJDBC.java:32)*
Is it because of ojdbc6.jar location?
Soluzione
Add the library in the project build path.
Altri suggerimenti
You just need to add ojdbc6.jar into classpath of your application.
you need to keep the jar file in external library follow this way
Then run it Please see the screenshots