Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

JDBC problem

hi ,
 suppose i have 5 tables ...say: A , B , C ,D , E.
i wanna read from table A and B and update C. Then i have to read from C and D and insert in to E. and if there is exception i wanna rollback the entire process. Now is it possible to insert in to table C and read from it again without commiting it ? . i mean can i read from table C if i have not commited the data in table C. i need to clarify that i am using the SAME Connection object for getting the Statement object.
  Also can you suggest me the best way of designing this in multithreaded environment >

Thanks
0
pravin_tiwari
Asked:
pravin_tiwari
1 Solution
 
netuser1976Commented:
Yes you can. You need to put all these transactions in the same transaction scope.
Thanks
Greg
0
 
pravin_tiwariAuthor Commented:
hi,
  how does a transaction scope come in to picture if i m using te same COnnection object ... i mean everything i do before commit will by default wil come in same transaction ..isn't it ?

 Thanks
0
 
superschlonzCommented:
Yes, that's right. Every statement you execute on the same connection
after a commit or rollback and before the next commit or rollback is in
the same transaction.
Don't forget to turn off autocommit !

And everything you change in a transaction can you read again in the
same transaction but not from other transactions until you made a
commit (which terminates the transaction and begins a new one).
0
 
NachiapCommented:
auto commit off is default,this is simple you dont want to do anything,just put all your operations in single transaction.
and in oracle till you close the connection that is considered as a single transaction.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now