Checking ur Mapping with ibatics !!
may be thats only the pblm!!
Main Topics
Browse All TopicsI have J2EE application running on OC4J application server. Where the database connection is dropping / resetting after some idle time. The idle time varies from 20 mins to 90 mins. The persistence layer is created using Spring and iBatis with Struts as controller.
I am not able to find that why the code / oracle database is trying to close the connection before it makes new one.
Here is the exception log:
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodesFactory] Looking up default SQLErrorCodes for DataSource [org.springframework.jdbc.
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Fetching JDBC Connection from DataSource
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Fetching JDBC Connection from DataSource
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Returning JDBC Connection to DataSource
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Returning JDBC Connection to DataSource
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodesFactory] Database product name cached for DataSource [org.springframework.jdbc.
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodesFactory] SQL error codes for 'Oracle' found
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodeSQLExceptionT
--- The error occurred in org/nexweb/qol/gcc/ibatis/
--- The error occurred while applying a parameter map.
--- Check the getUserByUserNameAndRealmN
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: Io exception: Connection reset by peer: socket write error]; SQL was [] for task [SqlMapClient operation]
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Returning JDBC Connection to DataSource
[05 Oct 2009 11:55:38] DEBUG [UserSqlMapDAO] Could not close JDBC Connection
java.sql.SQLException: Already closed.
at org.apache.commons.dbcp.Po
at org.apache.commons.dbcp.Po
at org.springframework.jdbc.d
at org.springframework.jdbc.d
at $Proxy0.close(Unknown Source)
at org.springframework.orm.ib
at org.springframework.orm.ib
at org.nexweb.qol.gcc.ibatis.
at org.nexweb.qol.gcc.ibatis.
at org.nexweb.qol.gcc.actions
at org.apache.struts.chain.co
at org.apache.struts.chain.co
at org.apache.struts.chain.co
at org.apache.commons.chain.i
at org.apache.commons.chain.g
at org.apache.commons.chain.i
at org.apache.struts.chain.Co
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at com.evermind.server.http.S
at com.evermind.server.http.S
at com.evermind.server.http.S
at com.evermind.server.http.S
at com.evermind.server.http.S
at oracle.oc4j.security.OC4JS
at com.evermind.server.http.S
at com.evermind.server.http.E
at _jsp._forward._jspService(
at com.orionserver.http.Orion
at oracle.jsp.runtimev2.JspPa
at oracle.jsp.runtimev2.JspSe
at oracle.jsp.runtimev2.JspSe
at javax.servlet.http.HttpSer
at com.evermind.server.http.S
at com.evermind.server.http.S
at com.evermind.server.http.H
at com.evermind.server.http.H
at com.evermind.server.http.H
at com.evermind.server.http.H
at com.evermind.server.http.H
at oracle.oc4j.network.Server
at com.evermind.util.Releasab
at java.lang.Thread.run(Threa
Here is the Spring.xml code related to datasource
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here is the spring.xml datasource bean which is now working:
<bean id="dataSource"
class="org.apache.commons.
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassN
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="validationQuery" value="SELECT 1 FROM DUAL"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionR
<property name="numTestsPerEvictionR
<property name="minEvictableIdleTime
</bean>
Business Accounts
Answer for Membership
by: mrjoltcolaPosted on 2009-10-05 at 13:41:23ID: 25499497
Try tuning / using the config parameters like "testWhileIdle" and "validationQuery" to keep the connections from being idled / disconnected by the remote server / firewall.
e.com/Prog ramming/La nguages/Ja va/ Q_23263 793.html dbcp/confi guration.h tml
http://www.experts-exchang
http://commons.apache.org/