Re: Statement.java patch (Postgresql 7.1.3)

From: "Ed Yu" <ekyu(at)sc(dot)rr(dot)com>
To: "pgsql-jdbc" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Statement.java patch (Postgresql 7.1.3)
Date: 2002-01-11 00:35:13
Message-ID: 008201c19a37$d56f3b40$bf00a8c0@sc.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Thanks, I'll download the 7.2 as a reference to avoid duplication.

----- Original Message -----
From: "Barry Lind" <barry(at)xythos(dot)com>
To: "Ed Yu" <ekyu(at)sc(dot)rr(dot)com>
Cc: "pgsql-jdbc" <pgsql-jdbc(at)postgresql(dot)org>
Sent: Thursday, January 10, 2002 12:46 PM
Subject: Re: [JDBC] Statement.java patch (Postgresql 7.1.3)

> Ed,
>
> If you look at current sources you will see that this has already been
> fixed in 7.2.
>
> thanks,
> --Barry
>
>
>
> Ed Yu wrote:
>
> > The use of Connection.setAutoCommit(false) will not work with batch
mode.
> > The following is a patch to properly fix up the Statement.java (jdbc2):
> >
> > *** Statement.java.orig Fri Feb 16 11:45:00 2001
> > --- Statement.java Wed Jan 9 22:40:34 2002
> > ***************
> > *** 377,389 ****
> > int size=batch.size();
> > int[] result=new int[size];
> > int i=0;
> > ! this.execute("begin"); // PTM: check this when autoCommit is
false
> > try {
> > for(i=0;i<size;i++)
> >
result[i]=this.executeUpdate((String)batch.elementAt(i));
> > ! this.execute("commit"); // PTM: check this
> > } catch(SQLException e) {
> > ! this.execute("abort"); // PTM: check this
> > throw new PSQLException("postgresql.stat.batch.error",new
> > Integer(i),batch.elementAt(i));
> > }
> > return result;
> > --- 377,396 ----
> > int size=batch.size();
> > int[] result=new int[size];
> > int i=0;
> > !
> > ! // Modified by Ed Yu <ekyu(at)asgnet(dot)psc(dot)sc(dot)edu>
> > ! // We want to use a transaction even if autoCommit is true which
> > ! // is the default for JDBC.
> > ! if (connection.getAutoCommit())
> > ! this.execute("begin");
> > try {
> > for(i=0;i<size;i++)
> >
result[i]=this.executeUpdate((String)batch.elementAt(i));
> > ! // If autoCommit is true, then commits
> > ! if (connection.getAutoCommit())
> > ! this.execute("commit");
> > } catch(SQLException e) {
> > ! this.execute("abort"); // This is ok since transaction is
always
> > on
> > throw new PSQLException("postgresql.stat.batch.error",new
> > Integer(i),batch.elementAt(i));
> > }
> > return result;
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Timo Savola 2002-01-11 11:41:33 ResultSet memory usage
Previous Message Peter Eisentraut 2002-01-10 23:57:56 Re: JDBC patch for DatabaseMetaData