I'll be using a multi-threaded Java program to insert new records to a table in MySQL. Is it necessary to synchronize for this? Or is it OK since each insert is a different record in my case?
views:
69answers:
1
+5
A:
The database driver will do this for you under the covers, if it is necessary. You should assume that the database can handle concurrent CRUD access.
The drivers I've used for SQLServer and Sybase have always locked the Connection
object, although you could be using multiple connections via a pool of course!
oxbow_lakes
2009-08-28 10:32:10
Sounds good. Just to clarify, would this sort of thing be a problem if a connection pool was being used?
FarmBoy
2009-08-28 10:37:05
It would not be a problem. As oxbow states you can assume that your database can handle concurrent inserts. It would be a damn poor database if it could not.
mlk
2009-08-28 10:54:55