ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: abator: PingQuery not behaving as expected
Date Thu, 11 Jan 2007 18:24:44 GMT
I think you're a little confused.  Abator is a code generator - it does not
come into play in your application after the code is generated.  In the
configuration you're showing, the "Pool.*" properties are ignored - Abator
does not utilize connection pooling.

However, you can set these properties in an *iBATIS* configuration file.
You should set them in the <dataSource> section like this:

<transactionManager type="JDBC" >
  <dataSource type="SIMPLE">
    <property name="JDBC.Driver" value="${driver}"/>
    <property name="JDBC.ConnectionURL" value="${url}"/>
    <property name="JDBC.Username" value="${username}"/>
    <property name="JDBC.Password" value="${password}"/>
    <property name="JDBC.DefaultAutoCommit" value="true" />
    <property name="Pool.TimeToWait" value="500"/>
    <property name="Pool.PingQuery" value="SELECT 1 FROM DUAL"/>
    <property name="Pool.PingEnabled" value="true"/>
    <property name="Pool.PingConnectionsOlderThan" value="3600000"/>
    <property name="Pool.PingConnectionsNotUsedFor" value="3600000"/>
  </dataSource>
</transactionManager>

Jeff Butler


On 1/11/07, Thomas Karl Schwaerzler <Thomas.Schwaerzler@uibk.ac.at> wrote:
>
> hi there again,
>
> i have ibatis/abator included in my web application using struts.
>
> everything is running great until now, but when i came to my testserver
> this morning i got the follwoing error
> when doing any request that needs access to database:
>
> ...
> Caused by: java.sql.SQLException: No more data to read from socket
>         at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
>         at
> oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java
:146)
>         at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
>         at
> oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1118)
>         at
> oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
>         at
> oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:106)
>         at
> oracle.jdbc.driver.T4CConnection.doRollback (T4CConnection.java:567)
> ...
>
>
>
> ..as far as know this error is caused by a connection timout at the
> database connection.
>
> i thought, that configuring a 'PingQuery' would prevent this by continuing

> sending kinda pings on the connection
> in case nothing else happens to keep it up.
> therefore i configured abator as follows:
>
>         <jdbcConnection
>                         driverClass=" oracle.jdbc.driver.OracleDriver"
>                         connectionURL="jdbc:oracle:thin:xxxxxxxxxxxxxxxxx"
>                         userId="xxxxxxxx"
>                         password="xxxxxx"
>                 >
>                 <classPathEntry location="xxxxxxxxx/ojdbc14.jar" />
>                    <property name="Pool.TimeToWait" value="500"/>
>            <property name="Pool.PingQuery" value="SELECT 1 FROM DUAL"/>
>            <property name="Pool.PingEnabled" value="true"/>
>            <!--  time in millisecs 3600000 = 1h -->
>            <property name="Pool.PingConnectionsOlderThan"
> value="3600000"/>
>            <property name="Pool.PingConnectionsNotUsedFor"
> value="3600000"/>
>         </jdbcConnection>
>
>
>
>
> i expected this configuration of abator to do pings every hour, which
> should be enough to keep the connection to
> database alive.
>
> why does abator/ibatis not behave as i expect?
> is there a possibility to check if the ping really happens?
>
>
> thanks in advance
> tom.
>
>

Mime
View raw message