Re: running complete transactions

From: tony (tonyvieitez_at_hotmail.com)
Date: 04/07/04


Date: 7 Apr 2004 01:38:17 -0700

Hi Chris

Ok, re-reading the api it seems that I have misunderstood the function
of Connection.setAutoCommit(false). I am trying to execute a group of
select statements on different tables in one batch, ensuring that once
the resultset is retrieved from the first select statement, that no
data is entered into the other tables before all the select statements
are executed on all tables.

Resultset one = Select * from tableA
--once resultset one has been collected no data should be entered
--into tableB or tableC before these next two select statements have
--finished executing
Resultset two = Select * from tableB
Resultset three = Select * from tableC

Thus I need a way to lock particular tables until I have read data
from all tables. The select queries that run are all distinct from
each other - select * from tableA, select * from tableB, select * from
tableC - there is no relationship between the tables to be able to
join the select statements into one query.

So setting the transaction level under this circumstance doesn't seem
appropriate, in that setTransactionIsolation(int level) only locks one
table - the table that is currently being accessed. Also setting
autoCommit to false doesn't help, since this is used for the purposes
of updates.

I would be grateful if you could tell me if I have understood the API
correctly, if you have any solutions I would very much appreciate
hearing them.

Tony

Chris Smith <cdsmith@twu.net> wrote in message news:<MPG.1adc89ac20d123679899cb@news.pop4.net>...
> tony wrote:
> > I have (unsuprisingly) a question. If I
> > myConnection.setAutocommit(false), then execute a number of ResultSet
> > rs = stat.executeQuery(aQuery) statements on different tables, then
> > execute myConnection.commit(), will all the tables that I have read
> > data from be locked for the period up untill commit()?
>
> Depends on the transaction isolation level. See the API docs for
> java.sql.Connection for details.



Relevant Pages

  • Re: Executing vbscript
    ... API in Java 6? ... If executing the VBscript is important, it might be better to use a JNI bridge to execute the Windows API to execute the VBscript directly as opposed to running through cmd.exe. ...
    (comp.lang.java.programmer)
  • Re: [RFC][PATCH] linux-2.6.2-rc2_vsyscall-gtod_B1.patch
    ... The whole vsyscall space is ... it means you can't execute it in the first place. ... the current API was presented around two years ago at UKUUG, ... better if you would send your complains to those lists at that time, ...
    (Linux-Kernel)
  • Re: Executing vbscript
    ... Are you talking about MS's "Office Open XML" format? ... file that excel could not open. ... bridge to execute the Windows API to execute the VBscript directly as ...
    (comp.lang.java.programmer)
  • Re: Executing vbscript
    ... Are you talking about MS's "Office Open XML" format? ... file that excel could not open. ... bridge to execute the Windows API to execute the VBscript directly as ...
    (comp.lang.java.programmer)
  • Re: Executing vbscript
    ... Are you talking about MS's "Office Open XML" format? ... file that excel could not open. ... bridge to execute the Windows API to execute the VBscript directly as ...
    (comp.lang.java.programmer)