aspose file tools*
The moose likes JDBC and the fly likes Getting Error Oracle.jdbc.driver does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting Error Oracle.jdbc.driver does not exist" Watch "Getting Error Oracle.jdbc.driver does not exist" New topic
Author

Getting Error Oracle.jdbc.driver does not exist

Gaurav Agarwal
Greenhorn

Joined: Oct 13, 2004
Posts: 18
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

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Dec 08, 2004
Posts: 11
Make sure that ojdbc14.jar is on your classpath.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

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


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Error Oracle.jdbc.driver does not exist