Solved

JDBC problem

Posted on 2001-06-19
4
175 Views
Last Modified: 2010-03-31
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
Comment
Question by:pravin_tiwari
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:netuser1976
ID: 6207758
Yes you can. You need to put all these transactions in the same transaction scope.
Thanks
Greg
0
 

Author Comment

by:pravin_tiwari
ID: 6207793
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
 
LVL 3

Accepted Solution

by:
superschlonz earned 10 total points
ID: 6208410
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
 

Expert Comment

by:Nachiap
ID: 6209152
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

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java exception bubble up 2 26
printf performancy 11 105
Java basic valueOf question 1 51
junit as external jar or library 7 59
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question