Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By travishein

Thread: Connection pooling

  1. #1
    bgrant is offline Member
    Join Date
    Oct 2011
    Posts
    5
    Rep Power
    0

    Post Connection pooling

    We're running eClinicalWorks, connection pooling doesn't appear to be working, wondering whether anyone sees an issue with maxactive value, etc:
    Java Code:
    <Context path="/mobiledoc" docBase="mobiledoc" debug="4" reloadable="true">
         <Resource name="jdbc/mobiledocDb" auth="Container" type="javax.sql.DataSource" initialSize ="45" maxActive="-2" maxIdle="45" maxWait="10000" validationQuery="SELECT 1" testWhileIdle="true" timeBetweenEvictionRunsMillis="1800000" minEvictableIdleTimeMillis="25" username="ecwUser" password="Pwd4Usr@LIFE" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://Lifepwpsql02/mobiledoc;maxStatements=0" removeAbandoned="true" removeAbandonedTimeout="120"/>
         </Context>
    Last edited by Fubarable; 10-27-2011 at 07:54 PM. Reason: code tags added

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default Re: Connection pooling

    what does "not working" mean?

    if this is a tomcat or commons-pool kind of connection pool configured in the server.xml, try adding
    Java Code:
    testOnBorrow="true"
    This also requires a validation query (which you have).

    Because, in most cases I have seen without testOnBorrow, a connection will be created and live in the pool, but after some amount of inactive time, the connection gets closed. Either the database itself is closing the connection, or networking switch or what ever timeout is occuring. The problem is the connection object from Java perspective is not notified this happened, so when the application tries to get a connection and it gets this stale connection, the application breaks.

    The testOnBorrow instructs the commons-pool to invoke the validation query before returning the connection to the application.
    Fubarable likes this.

  3. #3
    bgrant is offline Member
    Join Date
    Oct 2011
    Posts
    5
    Rep Power
    0

    Post Re: Connection pooling

    I mean idle connections don't appear to be evicted every 30 minutes, and we see waits on SQL server. Thank you for the response, it is tomcat, I'll make the additions you suggested.

  4. #4
    bgrant is offline Member
    Join Date
    Oct 2011
    Posts
    5
    Rep Power
    0

    Default Re: Connection pooling

    We're implementing the change, thanks again. I was concerned that the maxactive value was inappropriate (-2), have seen -1 as the norm for unlimited connections or a positive (100, 1000, etc), not an expert in this area so thought I would ask whether any negative value is ok for unlimited connections.

Similar Threads

  1. connection pooling problem
    By silversurfer2in in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-19-2010, 12:46 PM
  2. help required in connection pooling
    By silversurfer2in in forum New To Java
    Replies: 0
    Last Post: 04-15-2010, 08:47 AM
  3. Connection pooling
    By neeti in forum Networking
    Replies: 1
    Last Post: 11-11-2009, 05:54 PM
  4. Replies: 7
    Last Post: 10-20-2009, 11:34 AM
  5. connection pooling
    By kal132 in forum JDBC
    Replies: 1
    Last Post: 06-27-2007, 03:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •