import java.sql.*;
public class SQlConnection{
public static void main(String args[]){
try{
//loading the driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:MyDB");
Statement st=con.createStatement();
String a = "";
String q = "select level from myTable";
ResultSet rs = st.executeQuery(q);
while (rs.next()){
// retrieving information from the 11th field of the table
a = rs.getString(11);
System.out.println(a);
}
}
catch(Exception e){
System.out.println(e.getMessage());
System.out.println(e.toString());
System.out.println(e);
}
}
}
I am executing the above code and I am getting the following error can any one help me please?
sun.jdbc.odbc.JdbcOdbcDriver
java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
I am using: 1. Ms Sql Server 2012 Express Edition 2. Eclipse IDE for Java Developer Luna Service Release 2 (4.4.2) 3.Windows 10 Home Edition
Thanks in Advance