By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,017 Members | 951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,017 IT Pros & Developers. It's quick & easy.

DB2 connection time out error

P: 4
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.jar .
DB connection paramaters are

<data-sources>
<data-source id="DB2" type="org.apache.tomcat.dbcp.dbcp.BasicDataSource" >
<set-property property="username" value="XXXX"/>
<set-property property="maxActive" value="10"/>
<set-property property="password" value="XXXX"/>
<set-property property="url" value="jdbc:as400://XX.XX.XX.XX/MYLIB"/>
<set-property property="defaultAutoCommit" value="false"/>
<set-property property="maxWait" value="5000"/>
<set-property property="driverClassName" value="com.ibm.as400.access.AS400JDBCDriver"/>
</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,when 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.
Feb 19 '07 #1
Share this Question
Share on Google+
4 Replies


P: 4
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.jar .
DB connection paramaters are

<data-sources>
<data-source id="DB2" type="org.apache.tomcat.dbcp.dbcp.BasicDataSource" >
<set-property property="username" value="XXXX"/>
<set-property property="maxActive" value="10"/>
<set-property property="password" value="XXXX"/>
<set-property property="url" value="jdbc:as400://XX.XX.XX.XX/MYLIB"/>
<set-property property="defaultAutoCommit" value="false"/>
<set-property property="maxWait" value="5000"/>
<set-property property="driverClassName" value="com.ibm.as400.access.AS400JDBCDriver"/>
</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,when 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.
Feb 19 '07 #2

10K+
P: 13,264
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.jar .
DB connection paramaters are

<data-sources>
<data-source id="DB2" type="org.apache.tomcat.dbcp.dbcp.BasicDataSource" >
<set-property property="username" value="XXXX"/>
<set-property property="maxActive" value="10"/>
<set-property property="password" value="XXXX"/>
<set-property property="url" value="jdbc:as400://XX.XX.XX.XX/MYLIB"/>
<set-property property="defaultAutoCommit" value="false"/>
<set-property property="maxWait" value="5000"/>
<set-property property="driverClassName" value="com.ibm.as400.access.AS400JDBCDriver"/>
</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,when 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
Feb 19 '07 #3

10K+
P: 13,264
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.jar .
DB connection paramaters are

<data-sources>
<data-source id="DB2" type="org.apache.tomcat.dbcp.dbcp.BasicDataSource" >
<set-property property="username" value="XXXX"/>
<set-property property="maxActive" value="10"/>
<set-property property="password" value="XXXX"/>
<set-property property="url" value="jdbc:as400://XX.XX.XX.XX/MYLIB"/>
<set-property property="defaultAutoCommit" value="false"/>
<set-property property="maxWait" value="5000"/>
<set-property property="driverClassName" value="com.ibm.as400.access.AS400JDBCDriver"/>
</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,when 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.
Feb 19 '07 #4

P: 4
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

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Context path="/myapp" reloadable="true">
  3. <Environment description="URL for configuring log4j context" name="log4j/configuration-resource"
  4.             type="java.lang.String"
  5.             value="myapp-log4j.xml"/>
  6. <Environment description="JNDI logging context for this app" name="log4j/context-name"
  7.             type="java.lang.String"
  8.             value="myapp"/>
  9. </Context>
And my web.xml file have

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
  3.  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">
  4.  <display-name>myapp</display-name>
  5.  <filter>
  6.   <filter-name>SetCharacterEncoding</filter-name>
  7.   <filter-class>SetCharacterEncodingFilter</filter-class>
  8.   <init-param>
  9.    <param-name>encoding</param-name>
  10.    <param-value>UTF-8</param-value>
  11.   </init-param>
  12.  </filter>
  13.  <filter-mapping>
  14.   <filter-name>SetCharacterEncoding</filter-name>
  15.   <url-pattern>/*</url-pattern>
  16.  
  17.  </filter-mapping>
  18.  <listener>
  19.   <listener-class>org.apache.log4j.selector.servlet.ContextDetachingSCL</listener-class>
  20.  </listener>
  21.  <!-- Action Servlet Configuration -->
  22.  <servlet>
  23.   <servlet-name>action</servlet-name>
  24.   <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  25.   <init-param>
  26.    <param-name>config</param-name>
  27.    <param-value>/WEB-INF/struts-config.xml</param-value>
  28.   </init-param>
  29.   <load-on-startup>1</load-on-startup>
  30.  </servlet>
  31.  <!-- Action Servlet Mapping -->
  32.  <servlet-mapping>
  33.   <servlet-name>action</servlet-name>
  34.   <url-pattern>*.do</url-pattern>
  35.  </servlet-mapping>
  36.  <session-config>
  37.   <session-timeout>60</session-timeout>
  38.  </session-config>
  39.  <!-- The Usual Welcome File List -->
  40.  <welcome-file-list>
  41.   <welcome-file>index.jsp</welcome-file>
  42.  </welcome-file-list>
  43.  <jsp-config>
  44.   <taglib>
  45.    <taglib-uri>/WEB-INF/struts-bean</taglib-uri>
  46.    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  47.   </taglib>
  48.   <taglib>
  49.    <taglib-uri>/WEB-INF/struts-logic</taglib-uri>
  50.    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  51.   </taglib>
  52.   <taglib>
  53.    <taglib-uri>/WEB-INF/struts-html</taglib-uri>
  54.    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  55.   </taglib>
  56.   <taglib>
  57.    <taglib-uri>/WEB-INF/struts-tiles</taglib-uri>
  58.    <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
  59.   </taglib>
  60.   <taglib>
  61.    <taglib-uri>http://jsptags.com/tags/navigation/pager</taglib-uri>
  62.    <taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>
  63.   </taglib>
  64.  </jsp-config>
  65.  <login-config>
  66.   <auth-method>BASIC</auth-method>
  67.  </login-config>
  68. </web-app>
Feb 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.