I wrote this code to connect a MS Access database.
import java.sql.*;
public class Temp {
public static void main(String args[]) {
Connection con;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"
con = DriverManager.getConnection
("jdbcdbc:test;PWD=abc"
Statement stmt = con.createStatement();
String sql = "select uid from testing";
ResultSet rs = stmt.executeQuery(sql);
System.out.println(rs.getRow());
} catch(ClassNotFoundException e){
System.out.println(e.toString());
} catch(SQLException e){
System.out.println(e.toString());
}
}
}
However, the result of System.out.println(rs.getRow()); is 0, then I opened the file using Microsoft access and I found that the 10 records I entered before is still there, so can anyone help me what is going wrong and how can I retrieve the record from my code??
import java.sql.*;
public class Temp {
public static void main(String args[]) {
Connection con;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"
con = DriverManager.getConnection
("jdbcdbc:test;PWD=abc"
Statement stmt = con.createStatement();
String sql = "select uid from testing";
ResultSet rs = stmt.executeQuery(sql);
System.out.println(rs.getRow());
} catch(ClassNotFoundException e){
System.out.println(e.toString());
} catch(SQLException e){
System.out.println(e.toString());
}
}
}
However, the result of System.out.println(rs.getRow()); is 0, then I opened the file using Microsoft access and I found that the 10 records I entered before is still there, so can anyone help me what is going wrong and how can I retrieve the record from my code??