[Solved] 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.

 

Advertisements

About Saurabh Gupta

My Name is Saurabh Gupta, I have approx. 11 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.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s