6 Replies Latest reply on May 17, 2002 4:02 AM by Joel Cordonnier

    cvs HEAD: autocommit not working in some cases ?

    Renaud Bruyeron Newbie

      I checked out HEAD from cvs 15mn ago, fixed the DelegatingURLConnection that was broken yesterday on jdk1.3.1 (see automated build messages on jboss-dev) and rebuilt under w2k/1.3.1_01

      I have the following code in my MBean:

      DataSource dataSource = (DataSource) ctx.lookup(dsname);

      try {
      conn = dataSource.getConnection();

      PreparedStatement ps = conn.prepareStatement("INSERT INTO inputqueue (id, msgtype, ibnumber, destnumber, bodytext, deliverytime)\n " +
      " VALUES (seq_inputqueue.nextval, 8, ?, ?, ?, ?) ");

      ps.setString(1, destination);
      ps.setString(2, sender);
      ps.setString(3, body);
      ps.setTimestamp(4, new Timestamp(time));

      log.info("result of executeUpdate(): " + ps.executeUpdate());

      ps.close();
      } catch(SQLException se){
      log.error("oops...", se);
      } finally {
      try {
      log.info("Closing connection...");
      if(conn != null)
      conn.close();
      log.info("connection closed.");
      } catch (Exception e) {
      log.error("oops trying to close connection", e);
      } catch (NoSuchMethodError nsme) {
      log.error("damn", nsme);
      }
      }

      I started tinkering with this code because the INSERT was never committed into oracle until I shut down jboss.
      Then I realized the connection was not closed, hence the extra catch/log stuff at the end. I then realized that the LocalTxConnectionMananger and BaseConnectionManager2 triggered a NoSuchMethodError on any call to log.trace or log.isTraceEnabled() while inside the conn.close()

      After fixing that by commenting out all the log.* calls (even though I don't get it: jboss-common.jar is alright and I can see the log.trace() methods), I still have the problem with my INSERT not being committed to the database...

      I have other MBeans using the same connection pool (but performing an ResultSet.updateRow() instead of an insert) that work fine.

      I am using the oracle-service.xml from the examples with a proper OracleDbRealm configured.

      Any idea on
      1) the commit not going through
      2) the weird NoSuchMethodError on log.trace() ?

      - Renaud