i am just learning jdbs and i created a
test db in access and below is the error that i get
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
this is the code that creates the error
try
{
String strNumber = "124";
Statement cmdEmployees = conEmployees.createStatement();
ResultSet rsEmployees =
cmdEmployees.executeQuery("Select * from employees where ssn= '"+strNumber+"';");
lblOutput.setText(rsEmployees.getString("firstName"));
conEmployees.close();
}
catch(SQLException sqlError)
{
System.out.println("sqlException Error::: ");
System.out.println(sqlError + "\n");
}
i cannot figer out what is going on with this also the program is not loading the microsoft driver it loads the sun driver WHY? this is a Accss XP database here is the code below for that
try
{
Class.forName("com.ms.jdbc.odbc.Jdbc0dbcDriver");
}
catch(ClassNotFoundException error)
{
System.out.println("Could not load Microsoft driver::: " + error + "\n");
try
{
//load sun drivers
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("\n Loaded sun driver::: \n");
}
catch(ClassNotFoundException err)
{
System.out.println("Sun Driver did not load properly" + err + "\n");
}
}