Helpful Information
 
 
Category: MySQL
Ensuring database integrity

If I have a web page with a function that updates a database, what ensures that multiple users don't write to the database simultaneously and corrupt it? Does mySQL take care of this, or is there some lock command I must issue? I have been searching the doc, but I don't see anything.

G

I believe you asked this question before and I believe I answered it already. Yes databases incorporate a mechanism similar to locking files to ensure that simultaneous requests to read/write take turns.

OK, thanks. I guess when I read your earlier answer I was unclear what you were saying - it sounded like you were saying that one had to take specific actions with a database just as with a flat file to ensure integrity. Now, I understand that the database does this itself. That would be one good reason to use them. Thanks.


G

If you read up on the history of databases you will find that using organized file systems was one of the first concepts of a database. Files would be organized into directories then whatever program was written to handle searching, reading and writing had to deal with ensuring data integrity.










privacy (GDPR)