PDA

View Full Version : Ensuring database integrity


gorilla1
07-30-2002, 05:19 PM
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

Spookster
07-30-2002, 08:37 PM
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.

gorilla1
07-30-2002, 08:57 PM
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

Spookster
07-30-2002, 09:10 PM
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.