Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc - Mailing list pgsql-hackers

From Peter T Mount
Subject Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc
Date
Msg-id Pine.LNX.4.04.9905031157520.2109-100000@maidast.retep.org.uk
Whole thread Raw
In response to Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
On Sun, 2 May 1999, Tatsuo Ishii wrote:

> So far I couldn't find nothing special with the backend by now. Going
> back to the ImageViewer, I think I found possible problem with it. In
> my understanding, every lo call should be in single transaction block. 
> But ImageViwer seems does not give any "begin" or "end" SQL commands.
> I made a small modifications(see below patches) to the ImageViewer and
> now it starts to work again with 6.5 backend! I suspect that
> difference of palloc() code between 6.4.2 and 6.5 made the problem
> opened up.

This is true, and is probably why it was opened up.

However, with JDBC, you should never issue begin and end statements, as
this can cause the driver to become confused.

The reason is autoCommit. In jdbc, to start a transaction, you should call
the setAutoCommit() method in Connection to say if you want autocommit
(true), or transactions (false). The standard default is true.

> ---
> Tatsuo Ishii
> 
> *** ImageViewer.java~    Mon Oct 12 11:45:45 1998
> --- ImageViewer.java    Sun May  2 23:16:27 1999
> ***************
> *** 390,395 ****
> --- 390,396 ----
>     {
>       try {
>         System.out.println("Selecting oid for "+name);
> +       stat.executeUpdate("begin");
>         ResultSet rs = stat.executeQuery("select imgoid from images where imgname='"+name+"'");
>         if(rs!=null) {
>       // Even though there should only be one image, we still have to
> ***************
> *** 402,407 ****
> --- 403,409 ----
>       }
>         }
>         rs.close();
> +       stat.executeUpdate("end");
>       } catch(SQLException ex) {
>         label.setText(ex.toString());
>       }
> 

--       Peter T Mount peter@retep.org.uk     Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf



pgsql-hackers by date:

Previous
From: Thomas Malkus
Date:
Subject: (no subject)
Next
From: Peter T Mount
Date:
Subject: Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc