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 Nathan Modrzewski <nm...@eaglexm.com> on 2009/05/31 00:35:27 UTC

Connection Closing Problem

I am having a problem with my Postgresql 8.3 connections not being
closed when the program is finished. Here are a few of the messages from
the Postgresql log file:

2009-05-30 16:18:59 MDT [echodrive_machine @ echodrive]: LOG:
unexpected EOF on client connection
2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG:
unexpected EOF on client connection
2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG:
unexpected EOF on client connection
2009-05-30 16:19:02 MDT [echodrive_machine @ echodrive]: LOG:
unexpected EOF on client connection


I'm sure its something I'm doing wrong. I am using Apache Dbcp for my
connection pooling. I'm using IBatis 2.3.4 and Apache DBCP 1.2.2. 

Below is a the xml settings I use for my IBatis and DBCP setup.


<sqlMapConfig>
    <settings
        useStatementNamespaces="true"
        cacheModelsEnabled="false"
        enhancementEnabled="false"
        lazyLoadingEnabled="false"
        maxRequests="1024"
        maxSessions="256"
        maxTransactions="64"
    />

    <transactionManager type="JDBC" commitRequired="true">
	    <property name="JDBC.DefaultAutoCommit" value="false" />
	    <property name="JDBC.SetAutoCommitAllowed" value="false" />
          <dataSource type="DBCP">
                <property name="driverClassName"
value="org.postgresql.Driver" />
                <property name="url"
value="jdbc:postgresql://db-05.eaglexm.com:5432/${database}" />
		    <property name="username" value="${username}" />
		    <property name="password" value="${password}" />
		    <property name="maxActive" value="32" />
		    <property name="maxIdle" value="5" />
		    <property name="maxWait" value="30000" />
		    <property name="validationQuery" value="select id
from system_settings" />
		    <property name="logAbandoned" value="false" />
		    <property name="timeBetweenEvictionRunsMillis"
value="60000" />
		    <property name="numTestsPerEvictionRun" value="5" />
		    <property name="minEvictableIdleTimeMillis"
value="600000" />
        </dataSource>
    </transactionManager>

    ... my "sqlMap" statements / includes ...
</sqlMapConfig>

Below is some java code that uses it:

Reader reader =
Resources.getResourceAsReader("ibatis_map/echodrive/server/SqlMapConfig.
xml");
try {
    map = SqlMapClientBuilder.buildSqlMapClient(reader,properties);
    map.startTransaction();
    try { 
        // Do some selects / updates / inserts
         
        map.commitTransaction();
    } finally {
        map.endTransaction();
    }
} finally {
    reader.close();
}

If anyone has any ideas, I would appreciate it.

Thanks,
  -- Nathan

RE: Connection Closing Problem

Posted by Nathan Modrzewski <nm...@eaglexm.com>.
It is a standalone application. 

Also, I have tested using straight "JDBC" and it closes correctly.

-- Nathan

-----Original Message-----
From: Larry Meadors [mailto:larry.meadors@gmail.com] 
Sent: Saturday, May 30, 2009 5:08 PM
To: user-java@ibatis.apache.org
Subject: Re: Connection Closing Problem

Is this in a web application or standalone application?

Larry



On 5/30/09, Nathan Modrzewski <nm...@eaglexm.com> wrote:
> I am having a problem with my Postgresql 8.3 connections not being
> closed when the program is finished. Here are a few of the messages
from
> the Postgresql log file:
>
> 2009-05-30 16:18:59 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
> 2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
> 2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
> 2009-05-30 16:19:02 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
>
>
> I'm sure its something I'm doing wrong. I am using Apache Dbcp for my
> connection pooling. I'm using IBatis 2.3.4 and Apache DBCP 1.2.2.
>
> Below is a the xml settings I use for my IBatis and DBCP setup.
>
>
> <sqlMapConfig>
>     <settings
>         useStatementNamespaces="true"
>         cacheModelsEnabled="false"
>         enhancementEnabled="false"
>         lazyLoadingEnabled="false"
>         maxRequests="1024"
>         maxSessions="256"
>         maxTransactions="64"
>     />
>
>     <transactionManager type="JDBC" commitRequired="true">
> 	    <property name="JDBC.DefaultAutoCommit" value="false" />
> 	    <property name="JDBC.SetAutoCommitAllowed" value="false" />
>           <dataSource type="DBCP">
>                 <property name="driverClassName"
> value="org.postgresql.Driver" />
>                 <property name="url"
> value="jdbc:postgresql://db-05.eaglexm.com:5432/${database}" />
> 		    <property name="username" value="${username}" />
> 		    <property name="password" value="${password}" />
> 		    <property name="maxActive" value="32" />
> 		    <property name="maxIdle" value="5" />
> 		    <property name="maxWait" value="30000" />
> 		    <property name="validationQuery" value="select id
> from system_settings" />
> 		    <property name="logAbandoned" value="false" />
> 		    <property name="timeBetweenEvictionRunsMillis"
> value="60000" />
> 		    <property name="numTestsPerEvictionRun" value="5" />
> 		    <property name="minEvictableIdleTimeMillis"
> value="600000" />
>         </dataSource>
>     </transactionManager>
>
>     ... my "sqlMap" statements / includes ...
> </sqlMapConfig>
>
> Below is some java code that uses it:
>
> Reader reader =
>
Resources.getResourceAsReader("ibatis_map/echodrive/server/SqlMapConfig.
> xml");
> try {
>     map = SqlMapClientBuilder.buildSqlMapClient(reader,properties);
>     map.startTransaction();
>     try {
>         // Do some selects / updates / inserts
>
>         map.commitTransaction();
>     } finally {
>         map.endTransaction();
>     }
> } finally {
>     reader.close();
> }
>
> If anyone has any ideas, I would appreciate it.
>
> Thanks,
>   -- Nathan
>

-- 
Sent from my mobile device

Re: Connection Closing Problem

Posted by Larry Meadors <la...@gmail.com>.
Is this in a web application or standalone application?

Larry



On 5/30/09, Nathan Modrzewski <nm...@eaglexm.com> wrote:
> I am having a problem with my Postgresql 8.3 connections not being
> closed when the program is finished. Here are a few of the messages from
> the Postgresql log file:
>
> 2009-05-30 16:18:59 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
> 2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
> 2009-05-30 16:19:00 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
> 2009-05-30 16:19:02 MDT [echodrive_machine @ echodrive]: LOG:
> unexpected EOF on client connection
>
>
> I'm sure its something I'm doing wrong. I am using Apache Dbcp for my
> connection pooling. I'm using IBatis 2.3.4 and Apache DBCP 1.2.2.
>
> Below is a the xml settings I use for my IBatis and DBCP setup.
>
>
> <sqlMapConfig>
>     <settings
>         useStatementNamespaces="true"
>         cacheModelsEnabled="false"
>         enhancementEnabled="false"
>         lazyLoadingEnabled="false"
>         maxRequests="1024"
>         maxSessions="256"
>         maxTransactions="64"
>     />
>
>     <transactionManager type="JDBC" commitRequired="true">
> 	    <property name="JDBC.DefaultAutoCommit" value="false" />
> 	    <property name="JDBC.SetAutoCommitAllowed" value="false" />
>           <dataSource type="DBCP">
>                 <property name="driverClassName"
> value="org.postgresql.Driver" />
>                 <property name="url"
> value="jdbc:postgresql://db-05.eaglexm.com:5432/${database}" />
> 		    <property name="username" value="${username}" />
> 		    <property name="password" value="${password}" />
> 		    <property name="maxActive" value="32" />
> 		    <property name="maxIdle" value="5" />
> 		    <property name="maxWait" value="30000" />
> 		    <property name="validationQuery" value="select id
> from system_settings" />
> 		    <property name="logAbandoned" value="false" />
> 		    <property name="timeBetweenEvictionRunsMillis"
> value="60000" />
> 		    <property name="numTestsPerEvictionRun" value="5" />
> 		    <property name="minEvictableIdleTimeMillis"
> value="600000" />
>         </dataSource>
>     </transactionManager>
>
>     ... my "sqlMap" statements / includes ...
> </sqlMapConfig>
>
> Below is some java code that uses it:
>
> Reader reader =
> Resources.getResourceAsReader("ibatis_map/echodrive/server/SqlMapConfig.
> xml");
> try {
>     map = SqlMapClientBuilder.buildSqlMapClient(reader,properties);
>     map.startTransaction();
>     try {
>         // Do some selects / updates / inserts
>
>         map.commitTransaction();
>     } finally {
>         map.endTransaction();
>     }
> } finally {
>     reader.close();
> }
>
> If anyone has any ideas, I would appreciate it.
>
> Thanks,
>   -- Nathan
>

-- 
Sent from my mobile device