I get a java.lang.ClassNotFoundException
, when I execute the below code.
Could someone explain me why I am facing this? All I need to do is to connect to the db and fetch some values from it. Is it a problem with the eclipse that I use?
import java.sql.*;
public class test_sample {
public static void main(String[] args) {
try {
System.out.println("Test1");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Class.forName("oracle.jdbc.OracleDriver");
System.out.println("Test2");
Connection con = DriverManager.getConnection(
"jdbc:oracle:thin:@ussbazudb126.ussb.winson.net:1521/epdev", "manager", "<<PASSWORD>>");
System.out.println("Test3");
// Statement st = con.createStatement();
PreparedStatement meta = con.prepareStatement("select project from isac_extract");
System.out.println("Test4");
ResultSet rset = meta.executeQuery();
while (rset.next()) {
String project = rset.getString(1);
System.out.println(project);}
}
catch (Exception e){
e.printStackTrace();
}
finally {System.out.println("Final Block");}
}
}