Dear all,
I am using JBuilder 6 to run my servlet and application. I use my servlet to listen on port 80, and use the application to send a MIME message to the servlet. After sending out the message, the application updates a database, adding the message number in it.
The relating program is:
try{   con = connMgr.getConnection();
       if(con != null)
         System.out.println(con.toString());
       stmt = con.createStatement ();
       if(stmt != null)
         System.out.println(stmt.toString());
       int result = stmt.executeUpdate(query);
       con.commit();
       System.out.println(result);
       return result;
  }
  catch(SQLException ex)
  {
      throw new SQLException(ex.getMessage());
  }
  finally{
       try{
            stmt.close();
            connMgr.releaseConnection (con);
            System.out.println("finally");
           }
           catch (SQLException se)
            {
                se.printStackTrace();
            }
  }
I found that running the application in JBuilder can't update the database, although it gives no errors. Running the application in command line also can not work.The output is like this:
1
finally
 
You see the value of 'result' is 1, and this is right. But the database was not updated. It's very strange that everything was fine when I use Jbuilder to debug it: the database was updated properly, and the output was the same as before.
 
So I got confused: what's wrong in my program? Why debugging can work but running can not? What's the difference with them?
 
Can anyone help me? I'm really anxious. Thanks a lot!
 
Ying
 

Reply via email to