Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver in IntelliJ IDE Spark project

Hi I am facing the below issue while executing Sparksql Job(to read the Oracle table) in IntellJ IDE. Issue: Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

I have already added the ojdbc7.jar file in my project in IntelliJIdea ProjectStructure==>Modules==> Dependencies ==> + ==> Added ojdbc7.jar file.

In build.gradle file i have given the below statement.

"runtime files('libs/ojdbc7.jar')"

After i compiled my project i could see the jar file in libs folder that i have created in my project.

If i execute the Job in IDE I am facing this issue. Can any one please help me on the same.

like image 624
Ramesh Avatar asked Dec 21 '25 16:12

Ramesh


1 Answers

You need to download the driver on Intellij IDE itself and not the project you are working on since it's Intellij that needs the driver, the one in your project you can keep it since your application will need it. In your IDE, go to Database Menu on your right, chose the connection you created to connect to the DB then Properties. At the bottom it should show you a link, Download Missing Driver, click on that and you should be able to do your SQL queries using Intellij IDE.

like image 79
lmanyange Avatar answered Dec 24 '25 11:12

lmanyange



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!