HY010: Invalid state, the Connection object is closed (JTDS 1.2.5)

Avtar V
2014-05-12
2014-06-06
  • Avtar V

    Avtar V - 2014-05-12

    Hi All,

    I am running into this error, where the connection pool connections go into an invalid state and our app fails. I dont really know why this happen (either due to DB restarts/ failover or network issues), but the driver should be able to recover from this.

    we use jtds 1.2.5, tomcat 6 and mssql server 2012

    Exception:

    [2014-05-05 14:07:19,988] [db] SQLException loading table definition for Template_Composition with state HY010: Invalid state, the Connection object is closed.
    java.sql.SQLException: Invalid state, the Connection object is closed.
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1699)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.getMetaData(ConnectionJDBC2.java:2286)
    at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:255)

    JDBC settings:
    Resource name="csDataSource" auth="Container"
    type="javax.sql.DataSource" maxActive="100" maxIdle="30"
    username="hidden" password="hidden"
    driverClassName="net.sourceforge.jtds.jdbcx.JtdsDataSource"
    url="jdbc:jtds:sqlserver://somehost/somedb"
    validationQuery="SELECT 1"
    validationQueryTimeout="10"
    testWhileIdle="true"
    testOnBorrow="true"
    timeBetweenEvictionRunsMillis="120000"
    removeAbandoned="true"
    removeAbandonedTimeout="120"
    socketTimeout="600"
    socketKeepAlive="true"

    Any help on this issue will be much appreciated.

    -Avtar

     
    Last edit: Avtar V 2014-05-12
  • Bernd Eckenfels

    Bernd Eckenfels - 2014-06-06

    Actually this looks more like a DBCP problem, the validation/retry should also be done for metadata. Can you show the complete stacktrace, who is calling that method when?

    If this is a firewall problem, it might help to specify also maxConnLifetimeMillis=2601000 and make the evisction runs much more often. Both will clean out dead connections faster.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks