1 Reply Latest reply on Jul 1, 2008 9:27 AM by ro.dondi

    "The result set is closed." error on SQL Server

    ro.dondi

      I have a problem with my application running in jboss 4.2.2. I recive randomly the following error:

      java.sql.SQLException: The result set is closed.
       at org.jboss.resource.adapter.jdbc.WrappedResultSet.checkState(WrappedResultSet.java:1939)
       at org.jboss.resource.adapter.jdbc.WrappedResultSet.next(WrappedResultSet.java:1181)

      while processing a resultset in a stateless session bean. The bean is invoked by a web layer not directly, but through a session facade. I can reproduce this error running a test application made with Selenium. This test case reproduce several time the same user navigation flow. The test case uses few stateless session bean: everyone makes a query to the db using stored procedures. The error occurs not in the same piece of code everytime, but in different db call. Every call to ejb layer is synchronized. I check that every connections is closed after the use.
      Checking the connection pool i verified that only one connection is used.
      Follows the datasource definition.

      <local-tx-datasource>
       <jndi-name>myDS</jndi-name>
       <connection-url>jdbc:microsoft:sqlserver://dbserver:1433;SelectMethod=cursor;DatabaseName=myDBSchema</connection-url>
       <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
       <user-name>user</user-name>
       <password>password</password>
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
       <min-pool-size>1</min-pool-size>
       <max-pool-size>10</max-pool-size>
       <idle-timeout-minutes>15</idle-timeout-minutes>
       <blocking-timeout-millis>5000</blocking-timeout-millis>
      
       <!-- sql to call on an existing pooled connection when it is obtained from pool
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>MS SQLSERVER2000</type-mapping>
       </metadata>
       </local-tx-datasource>

      This error occurs using also Sql Server 2005.

      Any suggestions?
      Thanks

        • 1. Re:
          ro.dondi

          Setting the property

          <track-statements>false</track-statements>


          the error become:

          java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.