Scrolling through cursors

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Scrolling through cursors
Дата
Msg-id 002901c1ce2f$c4d913b0$807ba8c0@inspiron
обсуждение исходный текст
Ответ на Visualization of structure (OT?)  (Fredrik Wendt <fredrik.wendt@linux.se>)
Ответы Re: Scrolling through cursors  (Peter V Cooper <pvcooper@adelphia.net>)
Список pgsql-jdbc
Fredik

Here is some code which uses cursors

Dave

  public void testCursor()
  {
    Connection con = null;
    try {
      con = getConnection();

      // cursors work inside a transaction
      con.setAutoCommit(false);

      Statement stmt = con.createStatement();

      // sufficiently long select as to get us something we can scroll
through
      stmt.execute("declare cursorname cursor for select * from
pg_class");

      ResultSet rs = stmt.executeQuery("fetch 10 from cursorname");

      while (rs.next()){
        System.out.println(rs.getString(1));
      }
      rs.close();

      // close the cursor
      con.commit();

    }
    catch (Exception ex)
    {
      ex.printStackTrace();
    }
    finally
    {
      try {
        if ( con != null )
          con.close();
      }catch ( SQLException ex ) {}
    }

  }



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Dave Cramer"
Дата:
Сообщение: Re: Visualization of structure (OT?)
Следующее
От: Viacheslav N Tararin
Дата:
Сообщение: Re: JDBC Logging & log4j