This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
guys, have you had your code being blocked by a call to ResultSet.execute(sql)?? some times, when someone is locking some resource in the data base and I try to use the same resource the Data base puts my request in a stack to wait unitl some one releases the resource, and my application gets unaccesible? Any sugestions to solve the problem?
Leandro, I think you answered your own question. Usually this happens when another process has a lock on a table. Make sure to close all your statements/connections to avoid programs causing this error. Sometimes the problem occurs when you are looking at a table using an interactive tool and the tool crashes. In this case, you have to restart the database.
My application creates many connectiosn/statements and closes all of them. The problem is that there are other workers working directly with our ORACLE database (with SQL NAVIGATOR). And these users some times don't commit their transactions, and the sistem gets itself down, not responding to requests which need data base access... All I wanted is a way to notify the application user that there is another user working with that data and, tell him to try later.
Joined: Jul 27, 2002
Well, if that 's what you want, that is mostly information you can get from the system tables. How to go about that exactly , that 's another story. Highly product specific, and so. So, once again: what RDBMS are you using? Good riddance, Rudy.
You could execute the quesry in a seperate Thread, and after a given amount of time, call the cancel() method on the statement object (the original Thread would have to have a reference to it. All in all it's simple, but not for a beginning JDBC or Thread programmer. You's also want to make this a pattern in your development, and implement it in a generic way - so it's not a simple solution. I think that the bigger problem is people having direct access to run these types of locking queries on the database!