This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Error Oracle.jdbc.driver does not exist  RSS feed

 
Gaurav Agarwal
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the following error message:

C:\JavaProgram\Access.java:54: package oracle.jdbc.driver does not exist
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
^
1 error

Tool completed with exit code 1

Here is my code:



import java.sql.*;

public class Access {


public static void main(String args[]) {

Connection conn = null ;
Statement stmt = null;
ResultSet rs = null;
Employee emp = new Employee();

try {

DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());


I am using Windows XP, oracle9i.


Please help me.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, is the jar on your classpath?
Secondly, use Class.forName() and not DriverManager.registerDriver()

The first one calls the second, the second causes the driver to be registered twice.
 
Jim Cheng
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that ojdbc14.jar is on your classpath.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Cheng:
Make sure that ojdbc14.jar is on your classpath.


I don't know which JDK version you are using
for jdk1.4 or higher you can use ojdbc14.jar for connectivity..
or for lower version there is list on Oracle.com where you can find orcale jdbc driver related with your JDK versions..

hope it helps..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!