1 Reply Latest reply on Dec 19, 2004 4:12 PM by Mickaël Rémond

    INSERT statement does not commit

    Derek Scotney Newbie


      I have an interesting problem. I am using a prepared statement in JBoss 3.0.3 to insert an entry into a table on MS SQL SERVER 7.0.

      Connection con = null;
      PreparedStatement ps = null;

      try {
      con = EjbUtils.getConnection();

      ps = con.prepareStatement ("INSERT INTO USERINFO (UserInfoId, Logon, UserPassword) VALUES (?,?,?)");

      ps.setLong(1, pKey.longValue());
      ps.setString(2, logonName);
      ps.setString(3, userPassword);

      insertResult = ps.executeUpdate();
      if (insertResult != 1) {
      log.error("Error creating the user the user in the database:
      UserInfoId=" + pKey + ", Logon=" + logonName + ",
      Password=" + userPassword);
      catch (SQLException e) {
      log.error ("Error while creating the user: ",e);
      finally {
      //free the connection
      try {
      if (ps!=null)
      if (con!=null)
      catch (Exception e){
      log.error("Exception while freeing db resources", e);

      The ps.executeUpdate() statement returns a result of 1 which I understand to mean that 1 row was modified in the table. When I look at the table however, NO change has been made. The same code on a different table seems to work however. I have confirmed with our IT guys that the table rights are identical between the two tables in question, and if I execute the exact same SQL statement through a GUI interface like TOAD, the statement executes as expected.

      I have used an OPTA JDBC driver as well as the 0.9.1 jTDS driver and the results are the same.

      ANY suggestions/pointers would be appreciated.



        • 1. Re: INSERT statement does not commit
          Mickaël Rémond Newbie


          I have the same problem with JBoss 4.0.1 latest Release Candidate and PostgreSQL 8.0. If I do a select after the insert, I see the content of the table. However, the content is never commited. I was wondering what have change between Jboss 3.2 and Jboss 4.0 that could require some change in my code ?

          Thank you in advance, for your help.