Reputation: 1
I am trying to connect to oracle db through java code on windows. But getting this error "java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver" I placed 'ojdbc8'in the path (advanced settings-->env variables). but still i am getting same error. One more point is Oracle is not installed in my local , it is some other machine (server). I have installed SQL developer , so in the sqldeveloper folder (C:\Program Files\sqldeveloper-18.3.0.277.2354-x64\jdbc\lib) there is ojdbc8 jar file is present. so i copied it from there and placed in C:\Program Files/java/jre/lib/ext . Am i doing any wrong here?
Upvotes: 0
Views: 1861
Reputation: 952
Adding ojdbc8 in environment variable "path" will not add it to Class path. If you want to run the class with driver jar, While running the class please use the command java -classpath "path to ojdbc8 jar" "your class file name with package". Or you need to set the path of the jar in environment variable "classpath" and run your java class. If you already add your jar in classpath. Please recheck the path of the jar file.
Upvotes: 1