I'm currently running Microsoft SQL Express Server. When one user performs a query without committing it, it locks the entire table. The problem is that malicious users might "ruin" the database by doing so on purpose. How can I prevent this from happening?
- 2Need more info. What sort of query is it? How are they running the query without committing it?Greg– Greg2012-10-18 22:31:32 +00:00Commented Oct 18, 2012 at 22:31
- They use pyodbc, perform res = con.execute('insert into mytable...'), at that point the table is locked until they res.commit().prgDevelop– prgDevelop2012-10-18 22:33:08 +00:00Commented Oct 18, 2012 at 22:33
- 1Is this a programmer or a user locking the table? Are you waiting for the user to perform an action before you call commit?Greg– Greg2012-10-18 22:38:24 +00:00Commented Oct 18, 2012 at 22:38
- These are programmers, they can at any point decide to lock that table. Is it possible to set a lock timeout on a table or something like that?prgDevelop– prgDevelop2012-10-18 22:43:02 +00:00Commented Oct 18, 2012 at 22:43
Add a comment |
1 Answer
You need to understand database isolation levels http://en.wikipedia.org/wiki/Isolation_(database_systems). Most likely you are running queries as seralizable which will have that effect. Try submitting some code.