wood burning stoves*
The moose likes JDBC and the fly likes class not found exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "class not found exception " Watch "class not found exception " New topic
Author

class not found exception

jawwad ahmed
Ranch Hand

Joined: Dec 01, 2001
Posts: 179
Hi all;
Well i am getting exception when loading driver.
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
The program is
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.OracleDriver;
public class A
{
public static void main(String args[]){
Connection con=null;
Statement stmt=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
//con=DriverManager.getConnection("jdbc racle:thin:@JAWWAD:1521 EMREP","scott","tiger");
}catch(ClassNotFoundException e){
System.out.println(e);
}
//catch(SQLException e){
//System.out.println("The Sql En caught is");
//}
System.out.println("Success");
}
}
I have putten the class12.jar in g:\jdk1.3\jre\lib\ext\classes12.jar
Also have putten the oracle.jdbc.driver.OracleDriver in the A.java path but no way found.
Can any body tell where i am wong please.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
When using the "jre/lib/ext" method you need to be careful that you are putting your jars in the right place. On Windows systems, for example, there is often another "JRE" in Program Files, which may be used in preference to the one where you have put your jar file.
If you are running on a Windows system, please do a "find" on all your local disks to see if you have more than one such dirtectory. Of you have, try placing your Oracle jar in there as well.
Also, your "import" statement for the Oracle driver is not necessary, and may actually be wrong. When you create a class from it's name, you should not "import" it.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class not found exception
 
Similar Threads
JDBC Error
Problem with conn to oracle
How to configure oracle xe thin driver in xp
PROBLEMS IN CONNECTING TO ORACLE
Network adapter couldn't establish connection with the database