java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDr
iver? I get this error at run time.I used oracle10G. I set
CLASS PATH:C:\oraclexe\app\oracle\product\10.2.0
\server\jdbc\lib\ojdbc14.jar;
I write JDBC PROGRAM like
import java.sql.*;

class Example
{
public static void main(String args[])
{
try
{
Class.forName
("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","salmas");
System.out.println("Driver Connected");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from
emp");
while(rs.next())
{
System.out.println(rs.getInt(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}
st.close();
con.close();
}

catch(Exception e)
{
System.out.println(e);
}

finally
{
System.out.println("it's
finally block executed");
}

}
}

Answer Posted / amit singh

have you set the enoviornment variable if not then beacuse
of this the driver can not be load
because which you path
Class.forName
("oracle.jdbc.driver.OracleDriver");
in Class.forName("String" )
compiler search it out in bin/lib of jre or jre bin/lib/ext
so please check it out because of it this excption commonly
come
because if some one used Mysql and i did in past i got thsi
exception because it didn't set the Classpath for connection.jar
so do it getridof this thing
thanks
amitsing2008@gmail.com
amit09mca

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is DML?

569


What is java soft framework?

545


What is the use of jdbc?

554


What are the jdbc drivers in java?

519


How to use JDBC API to call Stored Procedures?

549






What is the difference between execute, executeQuery, executeUpdate?

519


Is there another way of dealing with the result set that could execute faster?

516


java based application for hospital management

3441


What does jdbc setmaxrows method do?

515


Which type of driver provides jdbc access via one or more odbc drivers?

517


What is ojvm used for?

544


Write an sql to find all records having all numeric characters in a field ?

489


How can we retrieve the file in the oracle database?

512


How many locking systems are there in jdbc?

551


What class.forname will do while loading drivers of jdbc?

492