JDBC insert hanging
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: JDBC insert hanging

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    NYC
    Posts
    39

    JDBC insert hanging

    Hi DBAs,

    I posted this question in Developer forum, no answers, let me try this forum ---
    I have an JDBC application which executes insert statement, this application has been running for 5 years well, but recently, insert hanging. I checked Oracle, it says: sql*net is waiting, table has many locks; but check JDBC, it says:"oracle busy".
    I insert the same statement from sql*plus, fine.

    What's wrong with it?
    The JDBC code as below:
    public void execute(Connection conn, Vector params, DataWrapper result) {
    PreparedStatement stmt = null;
    int count;
    try {
    stmt = conn.prepareStatement(getStatement()) ;

    bindVariables(stmt, params);
    //log.debug("Executing DML");
    count = stmt.executeUpdate();
    //log.debug("Returning Results");
    result.setUpdateCount(count);

    stmt.close();
    } catch (SQLException e) {
    result.setError(e);
    } finally {
    try {
    stmt.close();
    } catch (Exception ignored) {};
    }
    }
    The connection is initialized with setAutoCommit(true) before any statement is executed.
    We know the code gets to executeUpdate because we can see the affect of the insert statement in Oracle. We also know that the java code below never gets to the line result.setUpdateCount because the applications never get data back.

    Thanks!

    Betty

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,095
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Feb 2005
    Posts
    158
    "this application has been running for 5 years well, but recently, insert hanging"

    What changed ?

    "we can see the affect of the insert statement in Oracle"

    Does that mean you see the updated/inserted rows (ie committed successfully) or that you can see that sql in the V$ tables with lots of rows_processed ?
    If it is not committing, I'd look for a materialized view being refreshed, a deferred constraint resulting in a rollback or a table trigger being processed.

  4. #4
    Join Date
    Feb 2004
    Location
    NYC
    Posts
    39
    Thanks Jeff and gamyers,

    Nothing changed on code, if I insert the same row from sql*plus, no problem. It might be caused by some other reasons when calling the insert query from JDBC.
    I am going to turn on the trace file to see what is going on.

    It is not easy to catch the "hanging" query, because often after 2 or 3 days, developer goes to me to tell me "hanging".

    Betty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width