I have a problem where my WebSphere application is keeping a database table lock, or some kind of a lock, open after the user closes the browser window without logging off. I know that the DBAs can run a query against a system table to find out if the table is locked, but I don't have that access. So, I was wondering if there is another way I could find out, such as by doing some kind of a query that would hang or otherwise behave differently if the table were locked than if it were not locked. I had hoped that doing a SELECT COUNT(*) on the table would do the trick, but it worked even when I think the table is locked (but I am not sure). How about updating just one record in the table? I could try updating one record and if that fails, would that tell me if the table is locked?
As an example, here is a query I found on the web that I cannot use because I do not have access:
o1.name 'object name',
o1.type_desc 'object descr',
p1.partition_id 'partition id',
p1.rows 'partition/page rows',
a1.type_desc 'index descr',
a1.container_id 'index/page container_id'
FROM sys.dm_tran_locks as t1
INNER JOIN sys.dm_os_waiting_tasks as t2
ON t1.lock_owner_address = t2.resource_address
LEFT OUTER JOIN sys.objects o1 on o1.object_id = t1.resource_associated_entity_id
LEFT OUTER JOIN sys.partitions p1 on p1.hobt_id = t1.resource_associated_entity_id
LEFT OUTER JOIN sys.allocation_units a1 on a1.allocation_unit_id = t1.resource_associated_entity_id