Re: running complete transactions
From: tony (tonyvieitez_at_hotmail.com)
Date: 04/07/04
- Next message: tony: "Re: running complete transactions"
- Previous message: Joel Van Hoolandt: "TransactionsJTA Developer license for free!"
- In reply to: Chris Smith: "Re: running complete transactions"
- Next in thread: tony: "Re: running complete transactions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: tony: "Re: running complete transactions"
- Previous message: Joel Van Hoolandt: "TransactionsJTA Developer license for free!"
- In reply to: Chris Smith: "Re: running complete transactions"
- Next in thread: tony: "Re: running complete transactions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|