Also - look here for advice on configuing iBATIS with WebSphere:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Environment+Specific+Information

WebSphere requires that all transactions be committed, so you need to
configure iBATIS appropriately.

Jeff Butler



On Fri, Aug 22, 2008 at 11:58 AM, Jeff Butler <[EMAIL PROTECTED]> wrote:

>  iBATIS calls connection.close() at the end of a transaction.  If you are
> using explicit transactions, it happens when you call the endTransaction()
> method.  If you are not coding explicit transactions, then it happens at the
> end of the sqlMap methods like queryForList, insert, etc.
>
> You are using a JNDI datasource.  This means that connection.close() DOES
> NOT actually close the connection - it merely returns the connection to the
> pool.  The datasource is holding the connection open for reuse.  If the
> datasource is holding connections open too long for your liking, then you
> must change the parameters of the datasource (this is outside the scope of
> iBATIS).
>
> BTW - look in the org.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction
> class for connection.close() in iBATIS.  The garbage collector certainly
> does not close connections.
>
> Jeff Butler
>
>   On Fri, Aug 22, 2008 at 11:31 AM, SonyRaymond <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>>
>> Do you know when it will close the connection? We are facing a situation
>> that there are too many connections not closed after a long running of
>> applications, such that sometimes connections are not available to other
>> applications. I am not sure whether ibatis will close the connection
>> automatically, as I have browsed the source code that not found any coding
>> or framework that do this "close" connection job.
>>
>> I guess the connections are closed by the Garbage collector but not under
>> control by ibatis.
>>
>> Any experts can comment on this?
>>
>> Thanks,
>> Raymond
>>
>>
>> Jeff Butler-2 wrote:
>> >
>> > Why are you calling conn.close()?  iBATIS closes connections
>> > automatically.
>> >
>> > Jeff Butler
>> >
>> > On Mon, Aug 18, 2008 at 11:45 AM, SonyRaymond <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >>
>> >> No spring or EJB has been used. Only common JDBC calls
>> >>
>> >> This is my dao.xml
>> >>
>> >> <?xml version="1.0" encoding="UTF-8"?>
>> >> <!DOCTYPE daoConfig PUBLIC "-//iBATIS.com//DTD DAO Configuration
>> 2.0//EN"
>> >> "http://www.ibatis.com/dtd/dao-2.dtd";>
>> >> <daoConfig>
>> >>  <context>
>> >>        <transactionManager type="JDBC">
>> >>                <property name="DataSource" value="JNDI"/>
>> >>                <property name="DBJndiContext"
>> >> value="java:comp/env/jdbc/datasource-mssql"/>
>> >>        </transactionManager>
>> >>    <dao interface="com.aiab.iso.dbaccess.isoDaoIF"
>> >> implementation="com.aiab.iso.dbaccess.isoDaoJdbc" />
>> >>  </context>
>> >>  <context>
>> >>        <transactionManager type="JDBC">
>> >>                <property name="DataSource" value="JNDI"/>
>> >>                <property name="DBJndiContext"
>> >> value="java:comp/env/jdbc/datasource-sybase"/>
>> >>        </transactionManager>
>> >>    <dao interface="com.aiab.iso.dbaccess.isoSybaseDaoIF"
>> >> implementation="com.aiab.iso.dbaccess.isoSybaseDaoJdbc"/>
>> >>  </context>
>> >> </daoConfig>
>> >>
>> >> Exception : com.ibatis.dao.client.DaoException: Error ending JDBC
>> >> transaction.  Cause: com.ibm.websphere.ce.cm.ObjectClosedException:
>> >> DSRA9110E: Connection is closed.
>> >>
>> >> This exception is raised when "conn.close()" is executed. ** Where conn
>> >> is
>> >> SQLConnection
>> >>
>> >> I use MSSQL JDBC Driver for this testing.
>> >>
>> >> Any help??
>> >>
>> >> Thanks in advance,
>> >> Raymond
>> >>
>> >>
>> >> Clinton Begin wrote:
>> >> >
>> >> > Certainly not... :-)
>> >> >
>> >> > We'll need more information about your configuration:
>> >> >
>> >> > Which transaction manager are you using?  Which data source?  Which
>> >> > database
>> >> > driver
>> >> >
>> >> > Are you using Spring or EJB?
>> >> >
>> >> > Clinton
>> >> >
>> >> > On Fri, Aug 8, 2008 at 9:20 AM, SonyRaymond <[EMAIL PROTECTED]>
>> wrote:
>> >> >
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> I experience the following situation when using iBatis 2.2 with
>> >> WebSphere
>> >> >> 5.1 JNDI datasource, closing database connection after use will make
>> >> the
>> >> >> next getConnection() call gives error exception? (Connection
>> >> >> is closed!)
>> >> >>
>> >> >> Is it normal?
>> >> >>
>> >> >> Thanks,
>> >> >> Raymond
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Close-Connection-after-use--tp18893861p18893861.html
>> >> >> Sent from the iBATIS - User - Java mailing list archive at
>> Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Close-Connection-after-use--tp18893861p19035411.html
>> >>  Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Close-Connection-after-use--tp18893861p19110838.html
>>  Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>

Reply via email to