Friday, February 24, 2012

accessing the same database using multiple threads

hi,

do i need to use specially synchronized code if i have multiple threads inserting, updating and reading rows to and from the same database? in this case, i know that no 2 threads will try to insert or update the exact same row into the DB, however, multiple threads might try to read the same row from the database.

thanks!

No, if the threads are using different conenction objects you can use your code as you already might have implemented it. In case of reusing a SQLConnection object (using an instance or a singleton object) you will have to make sure that the connection does not already has an open transction as parallel transactions are not allowed (if you

are using explicit transactions9

Jens K. Suessmeyer


http://www.sqlserver2005.de

|||

ok cool fanks!!

No comments:

Post a Comment