This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Transaction" Watch "Transaction" New topic
Author

Transaction

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104

Hello
I have a question.

If I begin a transaction, (I am doing it with java, but I omit the code)

1 - I insert a value in a table

2 - now I try to insert a value in another table, I need the value I have Inserted before in table 1 because there is a referencial integrity.

3 I don't commit yet,
Here is my question.

I can't see the values of any data (in a data browser) until I commit them
Is the step 2 seeing the data inserted in 1, or Is step 2 going to complain about referencial integrity because It don't see any data until it is commited

Thanks
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30795
    
157

Fernando,
Step 2 does see the update from step 1 because it is within the same transaction. It is other transactions that can't see the update from step 1.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction