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 / vishnu

iam usin type 4 driver .using oracle 10g.when i am trying to run the code error came like this Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.
OracleDriver.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you perform truncation using JDBC?

575


What are the different types of statements? How we can you use preparedstatement.

509


What is jdbc connection string?

503


Does sql allow null values ? Can we use it within where clause ?

507


What is the full form of jdbc and what is its purpose?

539






Explain the process of creating tables using NetBeans IDE?

521


What is Apache DBCP API?

588


Explain the steps in writing a java program using jdbc?

446


Why do I have to reaccess the database for Array, Blob, and Clob data?

542


How do I know which jdbc driver to use?

596


Why do we use jdbc statements?

503


What is the benefit of having jdbcrowset implementation? Why do we need a jdbcrowset like wrapper around resultset?

489


code to insert values/rows into oracle database from a java swing textfield when a button is pressed(using preparedstatements)

3881


What is metadata in jdbc?

475


What is jdbc and odbc in java?

488