

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class test80 {

    static String m_username = "blind";
    static String m_password = "";
    static String m_connectionURL = "jdbc:postgresql://localhost:5432/fileswfs43?prepareThreshold=1&loglevel=2";

    public static void main(String[] p_args) {
        try {
            Class.forName("org.postgresql.Driver");
        } catch (Exception l_e) {
            System.out.println(l_e);
        }
        try {
            Connection l_dbcon = DriverManager.getConnection(m_connectionURL,
                    m_username, m_password);
            l_dbcon.setAutoCommit(false);
            PreparedStatement l_stmtDeclare = null;
            PreparedStatement l_stmtFetch = null;
            PreparedStatement l_stmtClose = null;
            l_stmtDeclare = l_dbcon.prepareStatement("DECLARE CUR CURSOR FOR SELECT 1");
            l_stmtFetch = l_dbcon.prepareStatement("FETCH FORWARD 10 FROM CUR");
            l_stmtClose = l_dbcon.prepareStatement("CLOSE CUR");
            while (true) {
                    l_stmtDeclare.execute();
                    l_stmtFetch.execute();
                    l_stmtClose.execute();
            }
        } catch (SQLException l_se) {
            System.out.println(l_se);
        }
    }
}
