Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String user = "user";
- String pass = "pass";
- Connection conn = DriverManager.getConnection(s, user, pass);
- conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
- conn.setAutoCommit(false);
- Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- stmt.setFetchSize(50);
- stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
- ResultSet rs = null;
- String sql = "select * from TABLE"; //long lasting select
- boolean ok = stmt.execute(sql);
- if (ok) {
- rs = stmt.getResultSet();
- while (rs.next()) {
- //do something
- }
- }
- if (rs != null) {
- rs.close();
- }
- if (stmt != null) {
- stmt.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement