Click here to Skip to main content
15,885,159 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Folks,

I have a requirement where I want to begin multiple transactions from single connection. I am able to begin transaction. Do commit or rollback. And start new. But my requirement is to start new transactions without committing or rolling back the previous transactions.

I saw in the MSDN site that it doen't support the Parallel Transactions.

Is there any work around or tricks to achieve this?

Thanks In Advance...
Happy Coding... :)
Posted
Comments
Jörgen Andersson 15-May-14 3:31am    
You can use nested transactions or savepoints, can you elaborate on your requirements a bit?
If you're using nested transactions the outermost transaction can only commit if all nested transactions are successful.
Linto Leo Tom 15-May-14 14:10pm    
Thanks Jorgen.....
Here my requirement is little different.
I have a collection of data. It will be huge in count. So I am using the TPL logic. Using the Parallel for each loop. So that I can use the multiple cores in my PC. So the execution time will be fast. Also important thing here is, in each of these loop, I have a some data which I am inserting to the DB. My requirement is like I don't want failure in any of these loops to cause other loops transaction, so that successful transaction will get committed to te DB and the others will get rolled back. That's why I want to begin multiple transaction so that I can commit or roll back based on the situation individually.

I can do it with different connections for each loop. But I am concerned about the Connection Pool also. I don't want much connections to be established at the same time.

Any thoughts for this requirement....

Thanks in Advance...
Happy Coding... :)
Jörgen Andersson 16-May-14 2:20am    
If I have understood you correctly: multiple sessions (or connections in this case) is the Oracle recommended way for your scenario.
But you will need some logic to control the number of connections. It should be kept below count(cpu)*2 assuming you're the only user on the server.
Linto Leo Tom 16-May-14 16:50pm    
Thanks Jorgen for your time.......
Even I also thought of doing this. But just wanted to share the idea with all the geeks here, so that if some trick may help to start multiple transactions.

Happy Coding... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900