Transactions do not work with Postgres 7.4

Description

There has been a bug report that doing transactions with postGIS 0.8 and postgresql 7.4 on cygwin does not work. The error says 'SET AUTOCOMMIT TO OFF is no longer supported'. I looked into this a bit and it looks like postgresql may have decided to not allow people to turn autocommit off, for some reason like the application should manage resources better or something. We need to look into it further.

Environment

None

Activity

Show:
codehaus
April 10, 2015, 4:43 PM

CodeHaus Comment From: jgarnett - Time: Fri, 6 Feb 2004 20:07:10 -0600
---------------------
From chris holmes email:

Yeah, I looked into a bit more and thought that would probably be the

answer. Thanks for finding it for me. Unfortunately I can't upgrade

directly, because I was using a patched jar. Do you know if I patch a new

jar will the 7.4 one be backwards compatible? I really should get the

change rolled in, but the list was incredibly unresponsive when I tried to

do it last time. It's pretty basic, jdbc1 and 2 stuff allows you to set

the charset, but they just didn't include the option for jdbc3 though all

the code is there to do it, it just needed a hook to set it.

Unfortunately I've already lost my old code that does it... So it goes, I

guess I'll just try to do it again... I have users who pretty much need

it, who complained when I dropped support for i

codehaus
April 10, 2015, 4:43 PM

CodeHaus Comment From: jgarnett - Time: Fri, 6 Feb 2004 20:07:39 -0600
---------------------
From DBlasby email (patch for setAutoCommit):

Here's the new function in jdbc1/AbstractJdbc1Connection.java

 public void setAutoCommit(boolean autoCommit) throws SQLException

    {

        if (this.autoCommit == autoCommit)

            return ;

        if (autoCommit)

        {

                execSQL("end"

        }

        else

        {

            if (haveMinimumServerVersion("7.1&quot)

            {

                execSQL("begin;" + getIsolationLevelSQL());

            }

            else

            {

                execSQL("begin"

                execSQL(getIsolationLevelSQL());

            }

        }

        this.autoCommit = autoCommit;

    }

codehaus
April 10, 2015, 4:43 PM

CodeHaus Comment From: cholmes - Time: Fri, 6 Feb 2004 20:22:33 -0600
---------------------
I think we should patch it the other way, not putting David's stuff in our driver, but our stuff in the latest jdbc driver. The code is trivial, I decompiled and found it. The BaseDataSource (org.postgresql.jdbc2.optional) class needs an extra field, two more methods, and one more line. Basically you need getter and setter methods for the charSet (I called it encoding), and then for the getConnection method you just need a line that says 'props.put("charSet", encoding); There is already support in jdbc1 for charSets, they just didn't bother to put accessors for jdbc2.optional.

codehaus
April 10, 2015, 4:43 PM

CodeHaus Comment From: jgarnett - Time: Wed, 25 Feb 2004 19:48:56 -0600
---------------------
cholmesny: No, leave it open. I uploaded the jar, but it's a reminder to me to email about getting the change rolled in.

codehaus
April 10, 2015, 4:43 PM

CodeHaus Comment From: cholmes - Time: Thu, 20 May 2004 10:23:57 -0500
---------------------
This is fixed, and we emailed with jdbc, and basically we should not be trying to set the charsets, after 7.2 multibyte support is enabled for all, so it should go fine into the java.

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

None

Affects versions

None

Priority

Medium
Configure