aspose file tools*
The moose likes JDBC and the fly likes code being blocked by ResultSet.execute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "code being blocked by ResultSet.execute" Watch "code being blocked by ResultSet.execute" New topic
Author

code being blocked by ResultSet.execute

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
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?
Rudy Dakota
Ranch Hand

Joined: Jul 27, 2002
Posts: 54
What database? What kind of statement? Some elementary information might help in thinking up a solution.
Please try again,
Rudy.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29275
    
140

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
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.
Rudy Dakota
Ranch Hand

Joined: Jul 27, 2002
Posts: 54
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.
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code being blocked by ResultSet.execute
 
Similar Threads
Max time of a thread in service method
Clean-up objects in session.
Logic lock must act like a real one: cause the current thread to give up the CPU
problem with security constraints
Tomcat hangs during startup