You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ulrich Staudinger <us...@activestocks.de> on 2006/11/29 16:47:59 UTC

How to avoid implicit transaction ?

Hi there,

despite the fact that ibatis is really very handy once you know how to 
use it, i am wondering if i can avoid the implicit transaction it starts 
when i want to read something from a datasource somehow.

Here is the output from my log:

1164808167.146 - INFO  "[getContact] 10" "-"
1164808167.146 - DEBUG Checked out connection 12159142 from pool. "-"
1164808167.146 - DEBUG {conn-100082} Connection "-"
1164808167.146 - DEBUG {conn-100083} Connection "-"
1164808167.185 - DEBUG "[getContact] fetched 16 values from db" "-"
1164808167.185 - DEBUG "[getContact] fetched  2 contact cards" "-"
1164808167.185 - DEBUG Returned connection 12159142 to pool. "-"

The problem is, that ibatis fetches a conncetion from the pool when i 
just read something from the cache. How can i avoid this ? Since there 
are no SQL statements in the debug log, it fetches information from the 
cache.

Now, when we disconnect the pc (on the network level) from the database 
network, ibatis stops to work, although it should fetch stuff from the 
cache. Actually ibatis throws an exception from somewhere inside 
transaction management when you pull the wire.

Anyway, this checking out and returning of connections is in my case the 
real performance problem.

Here are my configuration files:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 
2.0//EN"
    "http://ibatis.apache.org/dtd/sql-map-config-2.dtd 
<http://ibatis.apache.org/dtd/sql-map-config-2.dtd>">

<sqlMapConfig>
      <properties resource="database.properties"/>

  <settings
    cacheModelsEnabled="true"
    enhancementEnabled="true"
    maxSessions="64"
    maxTransactions="8"
    maxRequests="128"/>

  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}" name="JDBC.ConnectionURL"/>
      <property value="${username}" name="JDBC.Username"/>
      <property value="${password}" name="JDBC.Password"/>
      <property value="15" name="Pool.MaximumActiveConnections"/>
      <property value="15" name="Pool.MaximumIdleConnections"/>
      <property value="1000" name="Pool.MaximumWait"/>
     
      <property name="useUnicode" value="true"/>
      <property name="characterEncoding" value="UTF-8"/>
     
      <!-- ping query -->
      <property name="Pool.PingQuery" value="select 1 from contact2"/>
      <property name="Pool.PingEnabled" value="true"/>
      <property name="Pool.PingConnectionsOlderThan" value="60000"/>
      <property name="Pool.PingConnectionsNotUsedFor" value="60000"/>
     
    </dataSource>
  </transactionManager>
  <sqlMap resource="Contact.xml" />
    
 
</sqlMapConfig>



<sqlMap namespace="Contact">

      <cacheModel id="contact-cache" type="FIFO">
      <flushInterval hours="2"/>
      <flushOnExecute statement="flushStatement"/>
      <property name="size" value="10000" />
    </cacheModel>
[...]


Does someone have an idea how to avoid that implicit transaction ?

Thanks,
best regards,
Ulrich

P.s. could it be that the mail server for the ibatis list is quite slow 
? It takes aeons until i see my posts ... if i receive them at all. One 
of my former posts never reached me, but i see it online in the archives 
...

Re: How to avoid implicit transaction ?

Posted by Ulrich Staudinger <us...@gmail.com>.
>
>
>
> On 11/29/06, Brandon Goodin < brandon.goodin@gmail.com> wrote:
> >
> > What version of iBATIS are you using? This seems like an issue we
> > addressed in the past. If you are not running the latest please
> > upgrade and reexamine this. If you are then please provide a repetable
> > test that displays this problem.
> >
> > Thanks,
> > Brandon
>
>

Am using the release candidate and now it works :-) !

Good! You definitely have my vote on the GA candidate! Better sooner than
later.


Best regards,
-- 
Ulrich B. Staudinger

Re: How to avoid implicit transaction ?

Posted by Ulrich Staudinger <us...@gmail.com>.
Will double check, thanks


On 11/29/06, Brandon Goodin <br...@gmail.com> wrote:
>
> What version of iBATIS are you using? This seems like an issue we
> addressed in the past. If you are not running the latest please
> upgrade and reexamine this. If you are then please provide a repetable
> test that displays this problem.
>
> Thanks,
> Brandon
>
> On 11/29/06, Ulrich Staudinger <us...@activestocks.de> wrote:
> > Hi there,
> >
> > despite the fact that ibatis is really very handy once you know how to
> > use it, i am wondering if i can avoid the implicit transaction it starts
> > when i want to read something from a datasource somehow.
> >
> > Here is the output from my log:
> >
> > 1164808167.146 - INFO  "[getContact] 10" "-"
> > 1164808167.146 - DEBUG Checked out connection 12159142 from pool. "-"
> > 1164808167.146 - DEBUG {conn-100082} Connection "-"
> > 1164808167.146 - DEBUG {conn-100083} Connection "-"
> > 1164808167.185 - DEBUG "[getContact] fetched 16 values from db" "-"
> > 1164808167.185 - DEBUG "[getContact] fetched  2 contact cards" "-"
> > 1164808167.185 - DEBUG Returned connection 12159142 to pool. "-"
> >
> > The problem is, that ibatis fetches a conncetion from the pool when i
> > just read something from the cache. How can i avoid this ? Since there
> > are no SQL statements in the debug log, it fetches information from the
> > cache.
> >
> > Now, when we disconnect the pc (on the network level) from the database
> > network, ibatis stops to work, although it should fetch stuff from the
> > cache. Actually ibatis throws an exception from somewhere inside
> > transaction management when you pull the wire.
> >
> > Anyway, this checking out and returning of connections is in my case the
> > real performance problem.
> >
> > Here are my configuration files:
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> >
> > <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config
> > 2.0//EN"
> >     "http://ibatis.apache.org/dtd/sql-map-config-2.dtd
> > <http://ibatis.apache.org/dtd/sql-map-config-2.dtd>">
> >
> > <sqlMapConfig>
> >       <properties resource="database.properties"/>
> >
> >   <settings
> >     cacheModelsEnabled="true"
> >     enhancementEnabled="true"
> >     maxSessions="64"
> >     maxTransactions="8"
> >     maxRequests="128"/>
> >
> >   <transactionManager type="JDBC">
> >     <dataSource type="SIMPLE">
> >       <property value="${driver}" name="JDBC.Driver"/>
> >       <property value="${url}" name="JDBC.ConnectionURL"/>
> >       <property value="${username}" name="JDBC.Username"/>
> >       <property value="${password}" name="JDBC.Password"/>
> >       <property value="15" name="Pool.MaximumActiveConnections"/>
> >       <property value="15" name="Pool.MaximumIdleConnections"/>
> >       <property value="1000" name="Pool.MaximumWait"/>
> >
> >       <property name="useUnicode" value="true"/>
> >       <property name="characterEncoding" value="UTF-8"/>
> >
> >       <!-- ping query -->
> >       <property name="Pool.PingQuery" value="select 1 from contact2"/>
> >       <property name="Pool.PingEnabled" value="true"/>
> >       <property name="Pool.PingConnectionsOlderThan" value="60000"/>
> >       <property name="Pool.PingConnectionsNotUsedFor" value="60000"/>
> >
> >     </dataSource>
> >   </transactionManager>
> >   <sqlMap resource="Contact.xml" />
> >
> >
> > </sqlMapConfig>
> >
> >
> >
> > <sqlMap namespace="Contact">
> >
> >       <cacheModel id="contact-cache" type="FIFO">
> >       <flushInterval hours="2"/>
> >       <flushOnExecute statement="flushStatement"/>
> >       <property name="size" value="10000" />
> >     </cacheModel>
> > [...]
> >
> >
> > Does someone have an idea how to avoid that implicit transaction ?
> >
> > Thanks,
> > best regards,
> > Ulrich
> >
> > P.s. could it be that the mail server for the ibatis list is quite slow
> > ? It takes aeons until i see my posts ... if i receive them at all. One
> > of my former posts never reached me, but i see it online in the archives
> > ...
> >
>



-- 
Ulrich B. Staudinger

Re: How to avoid implicit transaction ?

Posted by Brandon Goodin <br...@gmail.com>.
What version of iBATIS are you using? This seems like an issue we
addressed in the past. If you are not running the latest please
upgrade and reexamine this. If you are then please provide a repetable
test that displays this problem.

Thanks,
Brandon

On 11/29/06, Ulrich Staudinger <us...@activestocks.de> wrote:
> Hi there,
>
> despite the fact that ibatis is really very handy once you know how to
> use it, i am wondering if i can avoid the implicit transaction it starts
> when i want to read something from a datasource somehow.
>
> Here is the output from my log:
>
> 1164808167.146 - INFO  "[getContact] 10" "-"
> 1164808167.146 - DEBUG Checked out connection 12159142 from pool. "-"
> 1164808167.146 - DEBUG {conn-100082} Connection "-"
> 1164808167.146 - DEBUG {conn-100083} Connection "-"
> 1164808167.185 - DEBUG "[getContact] fetched 16 values from db" "-"
> 1164808167.185 - DEBUG "[getContact] fetched  2 contact cards" "-"
> 1164808167.185 - DEBUG Returned connection 12159142 to pool. "-"
>
> The problem is, that ibatis fetches a conncetion from the pool when i
> just read something from the cache. How can i avoid this ? Since there
> are no SQL statements in the debug log, it fetches information from the
> cache.
>
> Now, when we disconnect the pc (on the network level) from the database
> network, ibatis stops to work, although it should fetch stuff from the
> cache. Actually ibatis throws an exception from somewhere inside
> transaction management when you pull the wire.
>
> Anyway, this checking out and returning of connections is in my case the
> real performance problem.
>
> Here are my configuration files:
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config
> 2.0//EN"
>     "http://ibatis.apache.org/dtd/sql-map-config-2.dtd
> <http://ibatis.apache.org/dtd/sql-map-config-2.dtd>">
>
> <sqlMapConfig>
>       <properties resource="database.properties"/>
>
>   <settings
>     cacheModelsEnabled="true"
>     enhancementEnabled="true"
>     maxSessions="64"
>     maxTransactions="8"
>     maxRequests="128"/>
>
>   <transactionManager type="JDBC">
>     <dataSource type="SIMPLE">
>       <property value="${driver}" name="JDBC.Driver"/>
>       <property value="${url}" name="JDBC.ConnectionURL"/>
>       <property value="${username}" name="JDBC.Username"/>
>       <property value="${password}" name="JDBC.Password"/>
>       <property value="15" name="Pool.MaximumActiveConnections"/>
>       <property value="15" name="Pool.MaximumIdleConnections"/>
>       <property value="1000" name="Pool.MaximumWait"/>
>
>       <property name="useUnicode" value="true"/>
>       <property name="characterEncoding" value="UTF-8"/>
>
>       <!-- ping query -->
>       <property name="Pool.PingQuery" value="select 1 from contact2"/>
>       <property name="Pool.PingEnabled" value="true"/>
>       <property name="Pool.PingConnectionsOlderThan" value="60000"/>
>       <property name="Pool.PingConnectionsNotUsedFor" value="60000"/>
>
>     </dataSource>
>   </transactionManager>
>   <sqlMap resource="Contact.xml" />
>
>
> </sqlMapConfig>
>
>
>
> <sqlMap namespace="Contact">
>
>       <cacheModel id="contact-cache" type="FIFO">
>       <flushInterval hours="2"/>
>       <flushOnExecute statement="flushStatement"/>
>       <property name="size" value="10000" />
>     </cacheModel>
> [...]
>
>
> Does someone have an idea how to avoid that implicit transaction ?
>
> Thanks,
> best regards,
> Ulrich
>
> P.s. could it be that the mail server for the ibatis list is quite slow
> ? It takes aeons until i see my posts ... if i receive them at all. One
> of my former posts never reached me, but i see it online in the archives
> ...
>