I am updating one row of the table using WITH (ROWLOCK), but by executing "sp_lock" I see that the whole table is locked. Thus, until a transaction is completed, other transactions cannot update other rows of the table. why does "WITH (ROWLOCK)" not take effect?
I use the following query with rowlock:
DELETE FROM DefDatabaseSession WITH (ROWLOCK) WHERE ProcessName='test';
at the same time, from any other transaction performing the same delete operation for the difference row in the same table, I get an exception
[SQLServer JDBC driver] [SQLServer] The timeout period for request blocking has been exceeded; The nested exception is java.sql.SQLException: [newscale] [SQLServer JDBC Driver] [SQLServer] Lock request timed out: com.newscale.bfw.udkernel.kernel.UdKernelException: udconfig.defdbsession.delete; unclassified SQLException for SQL [DELETE FROM DefDatabaseSession WHERE ProcessName =?]; SQL State [HY000]; error code [1222]; [newscale] [SQLServer JDBC Driver] [SQLServer] Request lockout timeout exceeded; The nested exception is java.sql.SQLException: [newscale] [SQLServer JDBC Driver] [SQLServer] The request lock timeout period has been exceeded.
source share