Cursor problems

Поиск
Список
Период
Сортировка
От Jeffrey Melloy
Тема Cursor problems
Дата
Msg-id 083DBFCC-8EAC-4A5F-BD61-3A82DFC45E5E@visualdistortion.org
обсуждение исходный текст
Ответы Re: Cursor problems
Список pgsql-jdbc
I was having trouble doing checkpoint commits on a cursor.  It's
possible I'm misunderstanding something basic, but it seems like
commiting on the same connection a cursor is on breaks the cursor.

Here's a pared-down snippet of code giving me the problem:

conn.setAutoCommit(false);

             pstmt = conn.prepareStatement("SELECT crash_id FROM
crash.crash_logs");
             pstmt.setFetchSize(50);

             rs = pstmt.executeQuery();

             pstmt = conn.prepareStatement("insert into blah " +
                     "values (?)");

             while(rs.next()) {
                 pstmt.setInt(1, rs.getInt("crash_id"));

                 pstmt.executeUpdate();

                 if(rs.getRow() % 50 == 0) {
                     System.out.println("Committing " + rs.getRow());
                     conn.commit();
                 }
             }

             conn.commit();

When I run it, I get the following error after the commit:
ERROR: portal "C_3" does not exist

I solved it by using two separate connections, but I'm not sure if
this is a bug or a misunderstanding on my part.

Jeff

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

Предыдущее
От: Mark Lewis
Дата:
Сообщение: Re: Encoding
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Cursor problems