Announcement Announcement Module
Collapse
No announcement yet.
Spring JDBC with Websphere 7 not closing connections Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring JDBC with Websphere 7 not closing connections

    Hi,

    It would be great if anybody could help in figuring out the DB connection issue that I have been facing. I looked into the tool for Websphere 7.0 and saw that the number of open connections keeps on increasing.

    The error is: Could not get JDBC Connection; nested exception is com.ibm.websphere.ce.cm.ConnectionWaitTimeoutExcep tion:

    I am using Jdbc templete hence not closing the connections expliciltly.

    Below is the Context.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schem...ng-jee-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    <jee:jndi-lookup id=" dataSource " jndi-name="jdbc/DS"
    cache="true" resource-ref="true" lookup-on-startup="true"
    proxy-interface="javax.sql.DataSource" />

    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
    <property name="dataSource" >
    <ref bean="dataSource"></ref>
    </property>
    </bean>

    <bean id="messageSource" class= "org.springframework.context.support.ResourceBundl eMessageSource">
    <property name="basenames">
    <list>
    <value>text.properties</value>
    </list>
    </property>
    </bean>


    <bean id="Impl" class="Impl" >
    <property name="jdbcTemplate" >
    <ref bean="jdbcTemplate"></ref>
    </property>
    <property name="messages" ref="messageSource"/>
    </bean>

    <bean id="DAO" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces">
    <value>DAO</value>
    </property>
    <property name="target">
    <ref bean="Impl"/>
    </property>

    </bean>
    </beans>



    Can anybody please help me with this !!!!!!

    Thanks

  • #2
    Use [ code][/code ] tags when posting code ...

    You aren't managing transactions and thus not managing resources (connections), to have proper resource management proper transaction setup is required. I suggest a read of the tx chapter of the reference guide.

    Comment


    • #3
      Thanks for the reply.


      A small query : The code works in WAS 6.1 and its giving proble in WAS 7.0.

      Can you please highlight me on this ?

      Thanks

      Comment


      • #4
        It still has to do with proper resource management, the fact that it works in WAS6.1 is more of a coincidence then it not working in WAS7, but that is imho of course. Could be the connections time out faster in WAS6.1, could be that it is much slower which leaves more time for connection time outs.. .Etc...

        The fact is still you don't have proper resource management (transactions) configured.

        Comment


        • #5
          Thanks again.

          Ill will look into this.

          CAn you please clarify another query.

          I am using jdbcTemplate. Will it not take care of opening and closing the connection itself ?

          Thanks

          Comment

          Working...
          X