aspose file tools*
The moose likes JDBC and the fly likes View of SQL Server getting locked in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "View of SQL Server getting locked in JDBC" Watch "View of SQL Server getting locked in JDBC" New topic
Author

View of SQL Server getting locked in JDBC

Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hello all,

I am using a JSP/JDBC which is having a select statement. The query refers to a VIEW created based on a join between 2 tables.
The JSP page displays the records which are fetched as a result of the query executed on the VIEW.

Problem faced :

The VIEW gets locked and the JSP page doesnt display any records.

Only when I release the lock on the view, I am able to see only a fraction of the records which are queried by the same VIEW.

BTW, There are no inserts or any other operations perfomed on these 2 tables from any other client/JSP pages.

Any idea what is going wrong.

Rgds,

Seetesh
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

How did you determine that the problem was a deadlock by the way? In normal operation SQL Server will use shared locks for views, and shared locks cannot cause deadlock problems with each other - shared locks can co-exist quite happily for the same row, page or table (hence the name "shared"). Such a lock should only cause a problem if some other process needs to update something which currently has a shared lock against it. It should also be released fairly quickly unless your transaction isolation level is set to SERIALIZABLE or REPEATABLE READ or you've used a HOLDLOCK locking hint.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: View of SQL Server getting locked in JDBC