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

 

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s