Reputation: 59405
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?
Upvotes: 2
Views: 781
Reputation: 134330
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!
Upvotes: 6