JDBC “java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver”


Generally, we get this issue In JDBC  connection code. On compile time it will not show any issue but when we run code will receive it because of Oracle Jar not added in  CLASSPATH  while JDBC is trying to load Oracle Driver by reflection.

Exception :

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at JDBCConnection.openConnection(JDBCConnection.java:19)
	at JDBCConnection.main(JDBCConnection.java:9)

 

Solution :

Add Oracle jar in your classpath.

Issues Solution

For more JDBC issue solution follow link Common JDBC Issues.

 

About Saurabh Gupta

My Name is Saurabh Gupta, I have approx. 10 Year of experience in Information Technology World manly in Java/J2EE. During this time I have worked with multiple organization with different client, so many technology, frameworks etc.
This entry was posted in Java, JDBC and tagged , . Bookmark the permalink.