From: | Barry Lind <blind(at)xythos(dot)com> |
---|---|
To: | dlangschied <dlangschied(at)ameritech(dot)net> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Newbie postgres/JDBC question. |
Date: | 2003-05-29 15:18:50 |
Message-ID: | 3ED624DA.8050203@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
David,
The sql clause FOR UPDATE is what you are looking for. As in SELECT FOO
FROM BAR FOR UPDATE (see the SELECT syntax in the doc). This will lock
the selected row(s) and prevent others from changing them.
Other users will not see any errors, they will just wait until the
lock(s) are released before they can continue.
thanks,
--Barry
dlangschied wrote:
> Hi all!
>
> I have a question that pertains to the update of records in a postgres
> database using JDBC. I extract a record from the database for update and,
> and after modification to the record, I place these changes into postgres.
> It does not look, via the documentation on JDBC, as if I have prevented
> someone from making changes at the same time. Is there a command that I
> must first perform to lock a record that is being updated? If a record is
> locked when another user wants access, what type of error information can be
> acquired to pass on to the user?
>
> Sincerely,
>
> David Langschied
> Langschied Consulting Services
> 25644 Mackinac
> Roseville, MI 48066
>
> Phone: (586)777-7542
> Cell: (248)789-8493
> e-mail: dlangschied(at)ameritech(dot)net
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-05-29 15:29:21 | Re: JDBC: One more autocommit use to work around |
Previous Message | Fernando Nasser | 2003-05-29 14:03:45 | JDBC: Updated LONGVARBINARY upload patch |