From: | Barry Lind <blind(at)xythos(dot)com> |
---|---|
To: | Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp> |
Cc: | pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Select For Update question |
Date: | 2003-03-26 07:03:52 |
Message-ID: | 3E8150D8.4040306@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Jean-Christian,
What you are doing is not the correct way. You should find a good
reference for JDBC as the questions you are asking are not postgresql
specific, but generic JDBC.
You should check out the Javadoc for the Connection object (go to
java.sun.com and review the javadoc for the java.sql package) and look
at the following methods:
setAutocommit()
commit()
rollback()
thanks,
--Barry
Jean-Christian Imbeault wrote:
> Barry Lind wrote:
>
>>
>> You are running with AutoCommit turned off aren't you?
>
> > Without autocommit being turned off, the locks will be immediately
>
>> released as soon as the statement autocommits and ends the tranaction.
>
>
> I am really new to using transactions with JDBC so I did not know about
> AutoCommit, I'll look into that. Anything else I should know about when
> trying to use transaction? I have been naively doing them as I would on
> the psql console, i.e:
>
> stmt.executeQuery("BEGIN");
> //many update statements
> stmt.executeQuery("COMMIT");
>
> From what you have written I'm guessing that is *not* the way to go
> about it ...
>
> Any pointers to documentation relation to transactions and JDBC welcomed :)
>
> Thanks,
>
> Jean-Christian Imbeault
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Shanmugasundaram Doraisamy | 2003-03-26 08:01:24 | Help Needed with Connection Pooling for Java Swing Based applications - reg. |
Previous Message | Jean-Christian Imbeault | 2003-03-26 06:46:46 | Re: jdbc.postgresql.org |