JDBC-ODBC SQL ResultSet Type Error

I am using jdbc-odbc bridge to connect to my navision database and when i compile, i received an sql exception error indicating that there is resultset type not supported. This is how i do it:

public class CreateCourseInfo{

public static void main(String[] args ) {

// Load the ODBC driver
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
}
catch (ClassNotFoundException e) {
System.err.println("Could not load the JDBC-ODBC Bridge");
return;
}

try {
FileOutputStream fos = new FileOutputStream("CourseInfo.xml");
Writer out = new OutputStreamWriter(fos, "UTF8");

out.write("<?xml version="1.0"?>
");
out.write("
");

try{
writeCourse(out);
}catch (IOException e){
System.err.println("Error in retrieving data!");
}
out.write("
");
out.close();
}
catch (IOException e) {
System.err.println("System Error!");
}


}

private static void writeCourse(Writer out) throws IOException {

Connection conn = null;
Statement stmnt = null;
ResultSet course = null;

try {
conn = DriverManager.getConnection("jdbc:odbc:xxx","xxx", "");

DatabaseMetaData conMD = conn.getMetaData();
System.out.println("Driver Name: " + conMD.getDriverName());
System.out.println("Driver Version: " + conMD.getDriverVersion());

stmnt = conn.createStatement();
System.out.print("Get Connected!");
String query = "Select * from Course";
course = stmnt.executeQuery(query);
............

the exception occurs when it goes to this line --->>
stmnt = conn.createStatement();

plss help me!! how actually to solve the 'resultset type not supported' exception.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories