DB2 connection time out error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maneeshjp
    New Member
    • Feb 2007
    • 4

    #1

    DB2 connection time out error

    Hi to all,
    I have wrote a jsp-servlet program(using struts) which connects to DB2 via JDBC.

    I am using Tomcat5.5.
    JDBC driver as400thinjdbc.j ar .
    DB connection paramaters are

    <data-sources>
    <data-source id="DB2" type="org.apach e.tomcat.dbcp.d bcp.BasicDataSo urce">
    <set-property property="usern ame" value="XXXX"/>
    <set-property property="maxAc tive" value="10"/>
    <set-property property="passw ord" value="XXXX"/>
    <set-property property="url" value="jdbc:as4 00://XX.XX.XX.XX/MYLIB"/>
    <set-property property="defau ltAutoCommit" value="false"/>
    <set-property property="maxWa it" value="5000"/>
    <set-property property="drive rClassName" value="com.ibm. as400.access.AS 400JDBCDriver"/>
    </data-source>
    </data-sources>


    The program is running fine and giving me all the expected values from DB2 BUT after 1hr or 2 or 3hrs of discontinuity from my web application,whe n I try to connect DB2 it takes 10-15 minutes.
    Sometimes it gives "Connection time out error" stating in my log file.

    I googled the internet but couldn't found any satisfied solution.

    I changed my driver to jt400.jar but no luck.

    Can you experts please point out the mistake I am doing.

    Thanks in advance.
  • maneeshjp
    New Member
    • Feb 2007
    • 4

    #2
    database connection time out error

    Hi to all,
    I have wrote a jsp-servlet program(using struts) which connects to DB2 via JDBC.

    I am using Tomcat5.5.
    JDBC driver as400thinjdbc.j ar .
    DB connection paramaters are

    <data-sources>
    <data-source id="DB2" type="org.apach e.tomcat.dbcp.d bcp.BasicDataSo urce">
    <set-property property="usern ame" value="XXXX"/>
    <set-property property="maxAc tive" value="10"/>
    <set-property property="passw ord" value="XXXX"/>
    <set-property property="url" value="jdbc:as4 00://XX.XX.XX.XX/MYLIB"/>
    <set-property property="defau ltAutoCommit" value="false"/>
    <set-property property="maxWa it" value="5000"/>
    <set-property property="drive rClassName" value="com.ibm. as400.access.AS 400JDBCDriver"/>
    </data-source>
    </data-sources>

    The program is running fine and giving me all the expected values from DB2 BUT after 1hr or 2 or 3hrs of discontinuity from my web application,whe n I try to connect DB2 it takes 10-15 minutes.
    Sometimes it gives "Connection time out error" stating in my log file.

    I googled the internet but couldn't found any satisfied solution.

    I changed my driver to jt400.jar but no luck.

    Can you experts please point out the mistake I am doing.

    Thanks in advance.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by maneeshjp
      Hi to all,
      I have wrote a jsp-servlet program(using struts) which connects to DB2 via JDBC.

      I am using Tomcat5.5.
      JDBC driver as400thinjdbc.j ar .
      DB connection paramaters are

      <data-sources>
      <data-source id="DB2" type="org.apach e.tomcat.dbcp.d bcp.BasicDataSo urce">
      <set-property property="usern ame" value="XXXX"/>
      <set-property property="maxAc tive" value="10"/>
      <set-property property="passw ord" value="XXXX"/>
      <set-property property="url" value="jdbc:as4 00://XX.XX.XX.XX/MYLIB"/>
      <set-property property="defau ltAutoCommit" value="false"/>
      <set-property property="maxWa it" value="5000"/>
      <set-property property="drive rClassName" value="com.ibm. as400.access.AS 400JDBCDriver"/>
      </data-source>
      </data-sources>
      The program is running fine and giving me all the expected values from DB2 BUT after 1hr or 2 or 3hrs of discontinuity from my web application,whe n I try to connect DB2 it takes 10-15 minutes.
      Sometimes it gives "Connection time out error" stating in my log file.

      I googled the internet but couldn't found any satisfied solution.

      I changed my driver to jt400.jar but no luck.

      Can you experts please point out the mistake I am doing.

      Thanks in advance.
      Copied to DB2 forum

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by maneeshjp
        Hi to all,
        I have wrote a jsp-servlet program(using struts) which connects to DB2 via JDBC.

        I am using Tomcat5.5.
        JDBC driver as400thinjdbc.j ar .
        DB connection paramaters are

        <data-sources>
        <data-source id="DB2" type="org.apach e.tomcat.dbcp.d bcp.BasicDataSo urce">
        <set-property property="usern ame" value="XXXX"/>
        <set-property property="maxAc tive" value="10"/>
        <set-property property="passw ord" value="XXXX"/>
        <set-property property="url" value="jdbc:as4 00://XX.XX.XX.XX/MYLIB"/>
        <set-property property="defau ltAutoCommit" value="false"/>
        <set-property property="maxWa it" value="5000"/>
        <set-property property="drive rClassName" value="com.ibm. as400.access.AS 400JDBCDriver"/>
        </data-source>
        </data-sources>

        The program is running fine and giving me all the expected values from DB2 BUT after 1hr or 2 or 3hrs of discontinuity from my web application,whe n I try to connect DB2 it takes 10-15 minutes.
        Sometimes it gives "Connection time out error" stating in my log file.

        I googled the internet but couldn't found any satisfied solution.

        I changed my driver to jt400.jar but no luck.

        Can you experts please point out the mistake I am doing.

        Thanks in advance.
        Possible reasons IMO.

        The project could be having a setting for automatically unpublishing itself from the server after some idle time.
        It could be trying to build the project when you tried to access the project.

        Comment

        • maneeshjp
          New Member
          • Feb 2007
          • 4

          #5
          Originally posted by r035198x
          Possible reasons IMO.

          The project could be having a setting for automatically unpublishing itself from the server after some idle time.
          It could be trying to build the project when you tried to access the project.
          First of all thanks for your reply.

          As I do not have any specific setting in my project.

          There are web.xml and context.xml files to set the project specification settings.
          I did not change any changes directly on my Tomcat5.5 server.xml or any other setting files.

          My context.xml file (in META-INF) have

          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          <Context path="/myapp" reloadable="true">
          <Environment description="URL for configuring log4j context" name="log4j/configuration-resource"
                      type="java.lang.String"
                      value="myapp-log4j.xml"/>
          <Environment description="JNDI logging context for this app" name="log4j/context-name"
                      type="java.lang.String"
                      value="myapp"/>
          </Context>
          And my web.xml file have

          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
           <display-name>myapp</display-name>
           <filter>
            <filter-name>SetCharacterEncoding</filter-name>
            <filter-class>SetCharacterEncodingFilter</filter-class>
            <init-param>
             <param-name>encoding</param-name>
             <param-value>UTF-8</param-value>
            </init-param>
           </filter>
           <filter-mapping>
            <filter-name>SetCharacterEncoding</filter-name>
            <url-pattern>/*</url-pattern>
          
           </filter-mapping>
           <listener>
            <listener-class>org.apache.log4j.selector.servlet.ContextDetachingSCL</listener-class>
           </listener>
           <!-- Action Servlet Configuration -->
           <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
             <param-name>config</param-name>
             <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
           </servlet>
           <!-- Action Servlet Mapping -->
           <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
           </servlet-mapping>
           <session-config>
            <session-timeout>60</session-timeout>
           </session-config>
           <!-- The Usual Welcome File List -->
           <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
           </welcome-file-list>
           <jsp-config>
            <taglib>
             <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
             <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
            </taglib>
            <taglib>
             <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
             <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
            </taglib>
            <taglib>
             <taglib-uri>/WEB-INF/struts-html</taglib-uri>
             <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
            </taglib>
            <taglib>
             <taglib-uri>/WEB-INF/struts-tiles</taglib-uri>
             <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
            </taglib>
            <taglib>
             <taglib-uri>http://jsptags.com/tags/navigation/pager</taglib-uri>
             <taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>
            </taglib>
           </jsp-config>
           <login-config>
            <auth-method>BASIC</auth-method>
           </login-config>
          </web-app>

          Comment

          Working...