Given that the people table has 10 rows, what is the result of the following when using a driver that supports a scroll sensitive Resultset?.
String sql = "select count(*) from people"; try (Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY)) { rs.next(); /*from w ww . j a va 2s .c o m*/ rs.absolute(0); // q1 System.out.print(rs.getInt(1)); // q2 }
B.
This code does not compile because the ResultSet options need to be supplied when creating the Statement object rather than when executing the query.
Since the code does not compile, Option B is correct.