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
What is DML?
What is java soft framework?
What is the use of jdbc?
What are the jdbc drivers in java?
How to use JDBC API to call Stored Procedures?
What is the difference between execute, executeQuery, executeUpdate?
Is there another way of dealing with the result set that could execute faster?
java based application for hospital management
What does jdbc setmaxrows method do?
Which type of driver provides jdbc access via one or more odbc drivers?
What is ojvm used for?
Write an sql to find all records having all numeric characters in a field ?
How can we retrieve the file in the oracle database?
How many locking systems are there in jdbc?
What class.forname will do while loading drivers of jdbc?