我正在使用以下代码从结果集中的数据库中获取数据:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection connection = DriverManager.getConnection(
"jdbc:oracle:thin:@host:1521:DB", "User","pass_01");
Statement statement = connection.createStatement();
resultset = statement.executeQuery("select * from employee");
System.out.println("Records Exist "+resultset.next());
System.out.println(resultset.getRow());
while (resultset.next()) {
System.out.println(resultset.getInt(1) + " " +
resultset.getInt(2) + " " +
resultset.getInt(3) + " " +
resultset.getString(4));
}
但是尽管数据库表中有两行,但我只得到一行。我在这里想念什么?