Re: SET AUTOCOMMIT TO OFF

Поиск
Список
Период
Сортировка
От Marcos Truchado
Тема Re: SET AUTOCOMMIT TO OFF
Дата
Msg-id 3FF81138.8000707@telefonica.net
обсуждение исходный текст
Ответ на SET AUTOCOMMIT TO OFF  (Joseph Shraibman <jks@selectacast.net>)
Список pgsql-jdbc
Joseph Shraibman wrote:

> After upgrading to 7.4.1, I keep getting this error:
>
> ERROR:  SET AUTOCOMMIT TO OFF is no longer supported
>
> ... when I do:
>
>   db = DriverManager.getConnection(url, usr, pwd);
>   db.setAutoCommit(false);
>
> isn't this supposed to be fixed in the 7.4.1 driver?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faqs/FAQ.html
>
So what is the correct way to do:

Connection conn = null; //I must init conn to some value, if not the
compiler told me that conn could be not initialiced

try {
    conn = getConnection();
    conn.setAutoCommit(false);
    Statement stat = conn.createStatement();

    stat.executeUpdate(command1);
    stat.executeUpdate(command2);
    ...

    conn.commit();
} catch(SQLException e) {
    conn.rollback();
    e.printStackTrace();
}




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

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: SET AUTOCOMMIT TO OFF
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: SET AUTOCOMMIT TO OFF