0 Replies Latest reply on Apr 30, 2002 12:07 PM by ihunter

    DB Connection (& Developer :-) Exhaustion

    ihunter

      Hi Folks,

      Using JBoss 2.4.3 (with Jetty) and MySQL (mm drivers)

      I'm running some stress tests using JUnit and after (exactly) 98 iterations of my test suite it hangs! Try to log into MySQL and no connections available. So it appears that the CP is growing even though ALL accesses are executing close on the connection after each access. MySQL is set up with max of 100 connections.

      I'd really appreciate some help on this. I've provided the releavant config, and the code used by all DB accesses below.

      Many thanks
      Ian Hunter

      <From jboss.jcml>
      <!-- NOTE : I originally used XADataSourceLoader, but had same problem -->





      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl


      tw

      jdbc:mysql://@DB_SERVER@/tw


      tw
      whatever


      BlockingTimeoutMillis=500000
      IdelTimeoutEnabled=true
      IdleTimeoutMinutes=30
      MaxSize=20
      CleanupIntervalMinutes=10
      MinSize=0
      MaxIdleTimeoutPercent=1.0
      GCEnabled=true
      GCIntervalMillis=60000
      GCMinIdleTime=10000





      </From jboss.jcml>

      <DB Java query>
      public Records executeQuery(Command comm)
      throws Exception
      {

      Records result = null;

      Connection conn = null;
      Statement stmt = null;

      try {

      conn = _connections.getConnection(); //From DS

      DatabaseMetaData dbmd = conn.getMetaData();
      String vendor = dbmd.getDatabaseProductName();

      stmt = conn.createStatement();

      ///////////////////////////////////
      // Execute command here....
      println("SQL='" + comm.getSql() + "'");
      ResultSet rs = stmt.executeQuery(comm.getSql());
      result = new Records(rs);
      rs.close();
      ///////////////////////////////////

      // The finally clause closes the connection/statement

      } catch(Exception exc) {
      println("Problem with database access: " +
      exc.getMessage());
      throw exc;
      } finally {
      try {
      if (stmt != null) stmt.close();
      } catch(SQLException exc) {
      // Not a lot we can do here..
      println("Problem in releasing connection");
      exc.printStackTrace();
      throw exc;
      } finally {
      try {
      if (conn != null) conn.close();
      } catch(SQLException exc) {
      // Not a lot we can do here..
      println("Problem in releasing connection");
      exc.printStackTrace();
      throw exc;
      }
      }
      }
      return(result);
      }

      </DB Java query>