try {
Statement stmt = connection.
createStatement();
// Get data using colunm names.
"SELECT * FROM mytable");
while (rs.next()) {
String s = rs.
getString("COL_A");
int i = rs.getInt("COL_B");
float f = rs.getFloat("COL_C");
process(s, i, f);
}
// Get data using colunm numbers.
rs = stmt.executeQuery(
"SELECT * FROM mytable");
while (rs.next()) {
int i = rs.getInt(2);
float f = rs.getFloat(3);
process(s, i, f);
}
}