pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Ledesma <aledes@euskalnet.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: problem with stored procedure ,transaction and jdbc
Date: Fri, 12 Aug 2005 18:25:07 +0000
Message-ID: <200508121825.07274.aledes@euskalnet.net> (raw)
In-Reply-To: <05B0404F-A541-4EC9-89C1-64BFE35474EF@fastcrypt.com>
References: <A3A54A1E-4C84-4EC0-8709-40EB9462DF02@sjtu.edu.cn>
	<05B0404F-A541-4EC9-89C1-64BFE35474EF@fastcrypt.com>

have you considered to enclose both stored procedures in a transaction inside 
another stored procedure, and call just one from the java code, something 
like :

CREATE FUNCTION stored_procedure_3()....
BEGIN;
 BEGIN TRANSACTION;
 PERFORM ..     call strored procedure 1
 PERFORM ..     call strored procedure 2
 COMMIT;
END;
' LANGUAGE plpgsql;

and your java code would be :

     set autocommit to false
     call strored procedure 3

Just and idea... ok ? I'm pretty new to java and postgresql too, so ... you 
know...

Hoe this help.


Andres
>On Friday 12 August 2005 05:09 pm, Dave Cramer wrote:
> Yes you can enclose two stored procedures inside a transaction.
>
> Can you call the second one on it's own without the first one without
> getting an exception ?
>
> Dave
>
> On 12-Aug-05, at 12:47 PM, Jiangyi wrote:
> > Hello everyone,
> >     I have a probem with stored procedure ,transaction and JDBC.
> > i am confused with the relation between stored procedure,
> > transcation and jdbc.
> >
> > supposed I have code looks like:
> >
> >     set autocommit to false
> >     call strored procedure 1
> >     call strored procedure 2
> >     when I call the second stored procedure, exception raised
> >     so I close the connection and the callable statement.
> >
> > My question is can I enclose the two stored procedure in a parent
> > transcaton
> > use JDBC ? If not , why?
> >
> > Regards
> > Jiang
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> >               http://archives.postgresql.org
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

-- 

Andres Ledesma
=================



view thread (5+ messages)  latest in thread

Message-ID: <200508121825.07274.aledes@euskalnet.net>
Permalink:  ../200508121825.07274.aledes@euskalnet.net/
Also on:    postgresql.org/message-id/200508121825.07274.aledes@euskalnet.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: aledes@euskalnet.net
  Subject: Re: problem with stored procedure ,transaction and jdbc
  In-Reply-To: <200508121825.07274.aledes@euskalnet.net>
  References: <A3A54A1E-4C84-4EC0-8709-40EB9462DF02@sjtu.edu.cn> <05B0404F-A541-4EC9-89C1-64BFE35474EF@fastcrypt.com> <200508121825.07274.aledes@euskalnet.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox