下面的代码退出while语句,因为它返回false并且不打印任何内容。
Class.forName(jdbcClassName);
con = DriverManager.getConnection(url,user,password);
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SOME_QUERY");
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
while (rs.next())
{
for (int i = 1; i <=numberOfColumns; i++)
{
System.out.println(rs.getString(i));
}
}
stmt.close();
con.close();
我想从第二行获取所有值。查询返回如下结果:
column1 column2 column3 column4 column5 column6 column7
ABC XYZ DEF MNO