I try this :

    <bean id="dataSourceArcDb" class="com.ibatis.common.jdbc.SimpleDataSource">
        <constructor-arg type="java.util.HashMap">
            <map>
                <entry key="JDBC.Driver" value="${jdbc.driverClassName}"/>
                <entry key="JDBC.ConnectionURL" value="${jdbc.url}"/>
                <entry key="JDBC.Username" value="${jdbc.username}"/>
                <entry key="JDBC.Password" value="${jdbc.password}"/>
                <entry key="JDBC.DefaultAutoCommit" value="${jdbc.defaultAutoCommit}"/>
                <entry key="Pool.PingQuery" value="SELECT 1"/>
                <entry key="Pool.PingEnabled" value="true"/>
                <entry key="Pool.PingConnectionsOlderThan" value="1000000"/>
            </map>
        </constructor-arg>
    </bean>

it seems to work fine...
Thanks everybody

TNO a écrit :
But I have a problem... I'm using Spring framework...

I use Spring to initialize my dataSource in the Spring application-context.xml:

    <bean id="dataSourceArcDb" class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName"><value>${jdbc.driverClassName}</value>
        </property><property name="url"><value>${jdbc.url}</value></property>
        <property name="username"><value>${jdbc.username}</value></property>
        <property name="password"><value>${jdbc.password}</value></property>
        <property name="defaultAutoCommit"><value>${jdbc.defaultAutoCommit}</value>
      </property>
    </bean>
...
  <bean id="sqlMapClientArcDb" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation">
      <value>classpath:arc/db/config/sql-map-config-arcdb.xml</value>
    </property>
  </bean>
...
  <bean id="adresseDAO" class="arc.db.dao.ibatis.AdresseDAOiBatis">
    <property name="dataSource"><ref bean="dataSourceArcDb" /></property>
    <property name="sqlMapClient"><ref bean="sqlMapClientArcDb" /></property>
  </bean>

With
org.apache.commons.dbcp.BasicDataSource, there is no property Pool.
They are specific to
com.ibatis.common.jdbc.SimpleDataSource.

and when I try to use a com.ibatis.common.jdbc.SimpleDataSource instead of org.apache.commons.dbcp.BasicDataSource,
Spring tells me that there is
no default constructor. Confirm by the javaDoc and the code, it needs a Map!

May be a little evolution to use a
com.ibatis.common.jdbc.SimpleDataSource with Spring is to create a default constructor ?

Thomas


Meindert a écrit :

It doesn’t have to be a “real” query, following settings worked for me (mysql)

<dataSource type="SIMPLE">

      …

      <property name="Pool.PingQuery" value="SELECT 1"/>

      <property name="Pool.PingEnabled" value="true" />

      <property name="Pool.PingConnectionsOlderThan" value="1000000" />

      …


From: TNO [mailto:[EMAIL PROTECTED]]
Sent: 19 August 2005 03:45 PM
To: ibatis
Subject: Error when web application is unused for a long time

 

Hello,

I am working on a web application using Ibatis, Spring and JSP on Jonasz Server with DB PostGre.
Sometime after 2 hours of inactivity, we have this error. With a F5 refresh on the navigator, the application re-works fine.

I wonder if Ibatis and my cache configuration can be involved in my error...
By the way, I have no cache configuration !

Here the exception, sorry it's the french one !

Thanks, Thomas

org.apache.jasper.JasperException: (SqlMapClient operation): encountered SQLException [  --- The error occurred in arc/cons/dao/ibatis/config/ConsFormulaireSQL.xml.  --- The error occurred while applying a parameter map.  --- Check the getConsFormulaire-InlineParameterMap.  --- Check the statement (query failed).  --- Cause: org.postgresql.util.PSQLException: Une erreur d''entrée/sortie a eu lieu lors d''envoi vers le serveur.]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:   --- The error occurred in arc/cons/dao/ibatis/config/ConsFormulaireSQL.xml.  --- The error occurred while applying a parameter map.  --- Check the getConsFormulaire-InlineParameterMap.  --- Check the statement (query failed).  --- Cause: org.postgresql.util.PSQLException: Une erreur d''entrée/sortie a eu lieu lors d''envoi vers le serveur.
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)


org.springframework.jdbc.UncategorizedSQLException: (SqlMapClient operation): encountered SQLException [  --- The error occurred in arc/cons/dao/ibatis/config/ConsFormulaireSQL.xml.  --- The error occurred while applying a parameter map.  --- Check the getConsFormulaire-InlineParameterMap.  --- Check the statement (query failed).  --- Cause: org.postgresql.util.PSQLException: Une erreur d''entrée/sortie a eu lieu lors d''envoi vers le serveur.]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:   --- The error occurred in arc/cons/dao/ibatis/config/ConsFormulaireSQL.xml.  --- The error occurred while applying a parameter map.  --- Check the getConsFormulaire-InlineParameterMap.  --- Check the statement (query failed).  --- Cause: org.postgresql.util.PSQLException: Une erreur d''entrée/sortie a eu lieu lors d''envoi vers le serveur.
    org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:99)
    org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:257)
    org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:184)
    org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:222)
    arc.cons.dao.ibatis.ConsFormulaireDAOiBatis.get(ConsFormulaireDAOiBatis.java:27)
    arc.cons.service.impl.ConsFormulaireMgrImpl.get(ConsFormulaireMgrImpl.java:49)
    sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
    arc.common.advice.PerformanceInterceptor.invoke(PerformanceInterceptor.java:65)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
    $Proxy8.get(Unknown Source)
    sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
    $Proxy9.get(Unknown Source)
    org.apache.jsp.tdb.tdbFormChamp_jsp._jspService(tdbFormChamp_jsp.java:103)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/08/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/08/2005



-- 
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...


-- 
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...


Reply via email to