• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC ODBC error

 
Manu Quartier
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I use Visual Age 3.0 and JDK 1.2.2. In VA, I have have no problem, but when I run my code with java.exe, I have an error:
The instruction at "0x...." referenced memory at "0x....". The memory could not be "read".
Can somebody help me?
Here is the code :
import java.sql.*;
public class DB {
public static void main(String args[]) {

String url = "jdbcdbc:Equadis";
Connection con;

String query = "select id_rayon, var_nom_rayon from rayon";

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url, "sa", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
stmt.close();
con.close();

System.out.println("gnagna test");
//the error appens here ->
while (rs.next()) {
System.out.println(rs.getString("id_rayon"));
}
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic