I've tried to make connection with oracle database using code:


import java.io.*;
import java.sql.*;

public class dbcon{
public static void main(String[] args) {
try{
String driver="oracle.jdbc.driver.OracleDriver";
Class.forName(driver);

String jdbcURL="jdbc:oracle:thin:@127.0.0.1:1521:stud";
String username="scott";
String password="tiger";
Connection conn=DriverManager.getConnection(jdbcURL,username,password);
System.out.println("***Connected to the database***");

conn.close();
}catch(ClassNotFoundException e){
System.out.println("could not find the database driver");
}catch(SQLException e){
System.out.println("The sql state=%s"+e.getSQLState());
}
}
}


But I'm getting ClassNotFoundExeption.Please resolve this.

By 29 posts, you should understand how to use [code] [/code] tags.

As for the exception, make sure you have that jar file in your class path.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.