Re: unlock Select for update

From: "jose antonio leo" <jaleo8(at)storelandia(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Cc: "Neil Conway" <neilc(at)samurai(dot)com>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: unlock Select for update
Date: 2003-03-11 10:35:57
Message-ID: KAEFLIDKHEJNPPKOLGHMCEIDCPAA.jaleo8@storelandia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes...
It is a web system. I Send part of code and explain in it.

JSP1
<jsp:useBean id="beanOfe" scope="session" class="eurocash.ManOfe"/> This
useBean instance ManOfe and connect to DB.

The user select a row to update and the jsp call the method
consultaTransaccional
beanOfe.consultaTransaccional(hae) //call the method consultaTransaccional
of ManOfe

JSP2
<jsp:useBean id="beanOfe" scope="session" class="eurocash.ManOfe"/> This
useBean instance ManOfe and connect to DB.

The user update the row and submit. the jsp call to method modifica...

beanOfe.modifica(hae) //call the method modifica of ManOfe

CLASS
public class ManOfe {
public UtilBD utilBD = new UtilBD(); // connect to DB

public Vector consultaTransaccional ( HOfe hOfeParam )
{
Vector vHOfe = new Vector();
hOfe.utilBD.inicioTransaccion(); //init transacstion
vHOfe = hOfe.consultaForUpdate( hOfeParam ); //execute select for
update. Lock the rows.
return (vHOfe); //return to jsp2
}

public HOfe modifica ( HOfe hOfeParam )
{
hOfeReturn = hOfe.modifica( hOfeParam ); // update the row locks
before
hOfe.utilBD.finalTransaccion(); //end transaction, unlock row.
return (hOfeReturn);
}

}

In this system if the web user close your browser the row keeps blocked.

I hope that you understand to me

-----Mensaje original-----
De: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
Enviado el: martes, 11 de marzo de 2003 10:01
Para: jose antonio leo
CC: Neil Conway; pgsql-general; Bruce Momjian
Asunto: Re: [GENERAL] unlock Select for update

On Tue, Mar 11, 2003 at 09:10:21AM +0100, jose antonio leo wrote:
> Unfortunately In my aplication this non occur . When the client
disconnects
> the row keep blocked and then I have kill the process manually for
unlocked
> the row.
>
> You know why it happends?

You're obviously doing something wrong, since if the client disconnected,
then there would be nothing to kill. You'll need to explain more about your
system before we can help you.

> -----Mensaje original-----
> De: Neil Conway [mailto:neilc(at)samurai(dot)com]
> Enviado el: lunes, 10 de marzo de 2003 19:05
> Para: jose antonio leo
> CC: Bruce Momjian; pgsql-general
> Asunto: RE: [GENERAL] unlock Select for update
>
>
> On Mon, 2003-03-10 at 12:15, jose antonio leo wrote:
> > Sorry, I explain more...
> > I have got a aplication that it do maintenance of DB, One user are
> updating
> > a row locked for a select for update and this user switch off your pc
and
> he
> > leaves the row locked.
>
> When the client disconnects, any uncommitted transaction (if any) will
> be aborted, so the lock will be released.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Support bacteria! They're the only culture some people have.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2003-03-11 10:48:19 Re: unlock Select for update
Previous Message shreedhar 2003-03-11 09:23:50 server closed the connection unexpectedly