SQL Update hangs Java program
I'm writing a combination Java/Perl program that parses XML files into an Oracle SQL database. There are two tables in the database - one that holds the data from the XML files and another that holds information about the files themselves (file name, creation time, etc.). Basically, when a new XML file comes along, the Java program checks to see if it has already been parsed, or partially parsed. If it has, it changes the STATUS
column in the filestatus table from 'good' to 'bad' for that file ID, using UPDATE FILESTATUS SET STATUS='bad' WHERE ID=?
. However, when I run it, it gets stuck doing this. Any ideas why this could happen? No error messages are occurring, it just hangs. The code is below.
static void markDataBad(String docID)
{
try
{
String update = "UPDATE FILESTATUS SET STATUS='bad' WHERE ID=?";
PreparedStatement updateStatus = Main.con.prepareStatement(update);
updateStatus.setString(1, docID);
updateStatus.execute();
}
catch (Exception ex) {ex.printStackTrace();}
}
I've already tried changing updateStatus.execute()
to updateStatus.executeQuery()
and updateStatus.executeUpdate()
, but nothing seems to have changed.
Thanks in advance!
Do you have uncommited changes to that table somewhere else? I had this problem today because I'd made some changes to the table in SQL*Developer, and that was holding onto a lock on the table until I committed it.
Does your user have permission for that table?
Have you issued before a lock on the table or a missing commit?
Can you run the query in shell?
精彩评论