2 Replies Latest reply on Aug 26, 2001 6:48 AM by David Joyner

    [sqlServerPool] No transaction right now.

    dorit Newbie

      I am using mssql db and i-net driver, when I am trying to do an insert query using that code:

      public static void insert(Connection conn, String sql) {
      PreparedStatement ps = null;
      try {
      ps = conn.prepareStatement(sql);
      int rows = ps.executeUpdate();
      System.out.println("insert rows: " + rows);
      } catch (Exception e) {
      System.out.println("Error: insert " + e.getMessage());
      }finally {
      if (ps!=null) ps.close();
      }catch(SQLException e) {

      I get no error and I can see the number of rows that are inserted,
      but looking in the db I don't see those new rows.
      and I keep receiving the lines:

      [sqlServerPool] No transaction right now.
      [sqlServerPool] Pool sqlServerPool [1/1/10] gave out pooled object: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@7a1576

      what do I have to do?
      and what does those lines mines?

      Thanks, Dorit

        • 1. Re: [sqlServerPool] No transaction right now.
          David Jencks Master

          Perhaps you are holding onto the connection between transactions? This currently does not work in jboss, and is usually a bad idea as it attempts to defeat connection pooling.
          You can hold onto the datasource. Assuming you have, try this:

          (in method)

          Connection conn = ds.getConnection();
          try {
          PreparedStatement ps = ...

          finally {

          This _is_ proper use of pooled connections. The connection you get is a handle to a real db connection, and calling close on it merely signals to jboss that you are done doing work on it and the transaction can end, and the connection can be reused.

          • 2. Re: [sqlServerPool] No transaction right now.
            David Joyner Newbie

            I'm getting the same error, using CMP (meaning you haven't done anything wrong in your code as far as handling the connection).

            Looking at SQL Profiler I see that every transaction is being rolled back with this statement

            if (@@trancount > 0) rollback tran

            I've tried three different JDBC drivers -- jnet direct, weblogic, merant.

            It seems to me this is an issue with jBoss and SQL Server. Are you using SQL Server 2000? Anybody got any ideas?

            Dave Joyner