开发者

SQL Update hangs Java program

开发者 https://www.devze.com 2022-12-20 20:31 出处:网络
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

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.

开发者_如何学C

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消