1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| public static ResultSet getData_DB(){
ResultSet rs;
Statement stmt = null;
try {
stmt = con.createStatement();
rs = stmt.executeQuery("select Id,cfg_Type,Pos_X,Pos_Y,Pos_Z from tbl_api_mobil");
System.out.println(rs.getFetchSize());
while (rs.next()) {
System.out.println(rs.getString(1));
}
return rs;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static void main(String[] args) {
ResultSet rt;
rt = getData_DB();
try {
while (rt.next()) {
System.out.println(rt.getString(1));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
Partager