Multiple thread accessing same DB tables from two different DB connections
I have some threads running on my program(each thread has its own connection to DB), which want to access the same tables will it cause any problems?
to be simple
I have:
2 threads T1 and T2
2 DB connections C1 and C2
1 table DBTable1
T1 is always uses C1 and T2 always uses C2
T1 is keep on inserting, deleting, updating table DBTable1
T2 is reading the table DBTable1
Will there be any issues?
i am using MS SQ开发者_运维问答L server.
Databases are specifically designed to handle concurrent users in these scenarios using transactions.
You'll have no problems. Database engines are designed for concurrency
If T2 calls while T1 is writing, it will wait until T1 finishes. This is not a problem.
Yes, as the database transactions follows ACID which makes sure of Concurrency through its Isolation property between different thread Operations.
精彩评论