Thread: SET AUTOCOMMIT TO OFF

SET AUTOCOMMIT TO OFF

From
Joseph Shraibman
Date:
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?

Re: SET AUTOCOMMIT TO OFF

From
Marcos Truchado
Date:
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();
}




Re: SET AUTOCOMMIT TO OFF

From
Kris Jurka
Date:

On Sun, 4 Jan 2004, Joseph Shraibman wrote:

> After upgrading to 7.4.1, I keep getting this error:
>
> ERROR:  SET AUTOCOMMIT TO OFF is no longer supported
>
> isn't this supposed to be fixed in the 7.4.1 driver?

Yes.  Are you sure you have a 7.4 series driver?

Kris Jurka


Re: SET AUTOCOMMIT TO OFF

From
Marcos Truchado
Date:
Kris Jurka wrote:
On Sun, 4 Jan 2004, Joseph Shraibman wrote:
 
After upgrading to 7.4.1, I keep getting this error:

ERROR:  SET AUTOCOMMIT TO OFF is no longer supported

isn't this supposed to be fixed in the 7.4.1 driver?   
Yes.  Are you sure you have a 7.4 series driver?

Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
              http://archives.postgresql.org
 

Works ok here.

Postgresql: 7.4.0
driver: pg74jdbc3.jar build 210


Connection conn = null;
    try {
        conn = getConnection();
       
        boolean autoCommit = conn.getAutoCommit();
        conn.setAutoCommit(false);

        ... do stuff with database
       
         conn.commit();
         conn.setAutoCommit(autoCommit);
    } catch(SQLException e) {
         conn.rollback();
         e.printStackTrace();
    }