I'm trying to connect Oracle database using this tutorial I have put ojdbc6.jar in the same folder with OracleJDBC.java.
But it gives me an error:
-------- Oracle JDBC Connection Testing ------
Where is your Oracle JDBC Driver?
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at jaa.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:13)
Don't understand what is the problem?
java -cp ..., so did you do that, and use the OS X paths to the.jarand your compiled class, rather than the Windows paths in their example?cp, as GyroGearless showed - though I'd slightly prefer the full paths, e.g.java -cp $PWD/ojdbc6.jar:$PWD OracleJDBC. That works for me with the code from that site.tnsnames.orafor this, no. Did you change the values in theDriverManager.getConnection()call to something appropriate for the DB you're trying to connect to?