1 Reply Latest reply on Feb 21, 2002 2:06 PM by davidjencks

    Connection Timeouts

    ericcire

      Hi,

      I have a simple stateless session bean that does a bunch of database queries.

      Every time there has been no activity for a while, all connections timeout - when I try to get a connection, the JDBC driver throws an exception. The tech support at Caribou Lake (the JDBC driver makers) says these are caused by timed-out connections.

      I have tried to match the IdleTimeout to the timeout for the Caribou Lake Jsvr JDBC drivers, tried to set JBoss's timeouts for half the time, to no avail.

      I have also tried to set the pooling level to 0 - hoping to force a brand new connection each time.

      As long as a client has been active for a while, there's no problem.

      I've worked with a few other J2EE servers, and except for this problem, I've had a very easy time using JBoss.

      Any help would be greatly appreciated!


      This is my setup:

      SunOS 5.8 Generic_108528-10 sun4u sparc SUNW,Ultra-4
      JBoss-2.4.3_Tomcat-3.2.3
      Database: CA Ingres
      JDBC: Caribou Lake Jsvr(http://www.cariboulake.com)

      jboss.jcml:

      org.hsqldb.jdbcDriver,com.cariboulake.jsql.JSQLDriver





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

      jdbc:caribou:jsqlingres://myHost:6024/patsrepo_db
      1200000
      user
      0
      password
      false
      false
      false
      true
      120000
      1800
      true
      true
      1.0
      0





      The Code:

      PreparedStatement prepStmt = null;
      ResultSet rs = null;
      Connection conn = null;
      Vector rows = new Vector();
      String query = QUERY_CUSTOMER_INFO;
      Customer customerData = new Customer();
      customerData.customerNumber = new Integer(customerID);

      try {
      conn = makeConnection();
      prepStmt = conn.prepareStatement(query);
      prepStmt.setInt(1,customerID);
      rs = prepStmt.executeQuery();
      while(rs.next()) {
      customerData.customerName = rs.getString(1);
      }
      }
      catch (SQLException e) {
      e.printStackTrace();
      }
      catch (ClassCastException e) {
      e.printStackTrace();
      }
      catch (NamingException e) {
      e.printStackTrace();
      }
      finally {
      if (rs != null) {
      try {
      rs.close();
      }
      catch (SQLException qx) {
      }
      }

      if (prepStmt != null) {
      try {
      prepStmt.close();
      }
      catch (SQLException qx) {
      }
      }
      if (conn != null) {
      try {
      conn.close();
      }
      catch (SQLException qx) {
      qx.printStackTrace();
      }
      }
      }
      Vector v = new Vector();
      v.add(customerData);
      return v;

        • 1. Re: Connection Timeouts
          davidjencks

          The settings you need to make the idletimeout work in 2.4 are remarkably obtuse, and I can't remember them for sure. I am sure you need to set GCEnabled true, and I think you need GCInterval + idleTimeout < idle timeout of your driver. With luck, when you get everything configured properly you will see messages in the log when the GC/idle timeout remover runs.