From: Lew on
gk wrote:
>>> while coding , shall I do this ?
>>>
>>> conn.setTransactionIsolation(conn.TRANSACTION_SERIALIZABLE);
>>> //select record in table1
>>> // insert record in table1
>>> //select record in table1
>>> conn.commit.
>>>
>>> is there any other extra code I need ? please let me know .where and
>>> how do I write the trasaction bengin and trasaction end in this code ?

Martin Gregorie wrote:
>> In your example you're: doing both reads and the insert in the same
>> transaction, so *of course* you'd expect the two selects to return
>> different results. On the other hand, if there were two transactions:
>>
>> # 1st transaction: serialised # 2nd transaction: auto-commit
>> # explicit commit unit # implicit commit unit
>>
>> conn.setTransactionIsolation
>> (conn.TRANSACTION_SERIALIZABLE);
>> //select record in table1
>> ... // insert record in table1
>> //select record in table1
>> conn.commit.
>>
>> ..then in this case you'd be right to expect the two selects to return
>> the same data set because they are in the same serialisable commit unit
>> and the insert is outside it.
>>
>> It doesn't matter whether the two transactions are run by separate
>> programs or both by the same program: that has no impact on transaction
>> isolation.

gk wrote:
> Please see this
>
> http://docs.google.com/View?id=dc83hzcs_380f8hkzdfb
>
> I still don't see any difference ....both the problems are same i.e
> PHANTOM READ and NON REPEATABLE READ's *Transaction 1 showing
> different results in two runs of Query 1*
>
> Where is the key difference between them then ?

Did you read my answer to this question?
>> The Wikipedia article up at the start of this thread addresses your question.
>>
>> http://en.wikipedia.org/wiki/Isolation_(database_systems)
>> "Repeatable reads (phantom reads)"

Phantom reads are a consequence of not setting transaction isolation to at
least REPEATABLE READ.

You should read the answers to the questions you ask.

Please trim your posts.

--
Lew
From: gk on
On Jun 19, 11:27 pm, Lew <no...(a)lewscanon.com> wrote:

> >http://docs.google.com/View?id=dc83hzcs_380f8hkzdfb
> Phantom reads are a consequence of not setting transaction isolation to at
> least REPEATABLE READ.
>
> You should read the answers to the questions you ask.
>
> Please trim your posts.
>
> --
> Lew

did you look at the link I posted .
http://docs.google.com/View?id=dc83hzcs_380f8hkzdfb

Those are taken from Wikipedia . What I am asking was to see the
Definition of PHANTOM READ and NON-REPEATABLE READ there. It seems
to me that both of them are discussing the same problem .Both of
them shows *Transaction 1 showing different results in two runs
of Query 1*

where is the key difference(if any) ?







From: Lew on
gk wrote:
> Those are taken from Wikipedia . What I am asking was to see the
> Definition of PHANTOM READ and NON-REPEATABLE READ there. It seems
> to me that both of them are discussing the same problem .Both of
> them shows *Transaction 1 showing different results in two runs
> of Query 1*
>
> where is the key difference(if any) ?

Phantom read is a different number of rows returned from the query.
Non-repeatable read is different values returned for a given row.

Once again, this question was answered in the web page to which you've been
repeatedly directed:
http://en.wikipedia.org/wiki/Isolation_(database_systems)

specifically at
http://en.wikipedia.org/wiki/Isolation_(database_systems)#Repeatable_reads_.28phantom_reads.29
vs.
http://en.wikipedia.org/wiki/Isolation_(database_systems)#Read_Committed_.28Non-repeatable_reads.29

--
Lew
From: Lew on
Lew wrote:
> Phantom reads are a consequence of not setting transaction isolation to
> at least REPEATABLE READ.

Oops. I mean at least *stricter than* REPEATABLE READ, i.e., SERIALIZABLE. I
apologize for the misinformation.

--
Lew
From: gk on
On Jun 20, 10:34 am, Lew <no...(a)lewscanon.com> wrote:
> gk wrote:
>
> > where is the key difference(if any) ?
>
> Phantom read is a different number of rows returned from the query.

True . because in the example they are using "INSERT" in transaction
2

surprisingly , Phantom read also called "REPEATABLE READ" . Is it
because they are not MODIFYING the values but adding some extra
records into it ? i.e it repeates the values with some additional
records.


> Non-repeatable read is different values returned for a given row.

True . because in the example they are using "UPDATE" in transaction
2.


However,both of them are showing faulty results at the end of
Transaction 1.


> Once again, this question was answered in the web page to which you've been
> repeatedly directed:http://en.wikipedia.org/wiki/Isolation_(database_systems)
>
> specifically athttp://en.wikipedia.org/wiki/Isolation_(database_systems)#Repeatable_...
> vs.http://en.wikipedia.org/wiki/Isolation_(database_systems)#Read_Commit....
>
> --
> Lew