views:

88

answers:

2

Hello

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!

+3  A: 

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.

Paul Tomblin
Turns out I did. Ran commit on the database and now it updates without a problem (well, except for the problems that came up further along in the code).Thanks!
ryantmer
A: 

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?

Pentium10