0

I have deployed an EAR in Wildfly-8.2.0.Final application server. After some hours of inactivity, I am getting the below error:

Caused by: java.sql.SQLException - JZ0C0: Connection is already closed.
   at com.sybase.jdbc4.jdbc.ErrorMessage.raiseError(Unknown Source)
   at com.sybase.jdbc4.jdbc.SybConnection.checkConnection(Unknown Source)
   at com.sybase.jdbc4.jdbc.SybConnection.setAutoCommit(Unknown Source)
   at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkTransaction(BaseWrapperManagedConnection.java:893)
   at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:1594)
   at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:398)
   at com.test.it.TestConnection.prepareStatement(TestConnection.java:1045)

Please find below the datasource subsystem definition used in standalone-full-ha.xml.

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
        <datasources>
            <datasource jta="true" jndi-name="java:/SybaseDB" pool-name="SybaseDB" enabled="true" use-java-context="true" spy="false" use-ccm="true">
                <connection-url>jdbc:sybase:Tds:id_address:port/DBname</connection-url>
                <driver-class>com.sybase.jdbc4.jdbc.SybDriver</driver-class>
                <connection-property name="HOSTNAME">TestHost</connection-property>
                <connection-property name="SQLINITSTRING">set quoted_identifier,forceplan off</connection-property>
                <connection-property name="LANGUAGE">us_english</connection-property>
                <connection-property name="CHARSET">iso_1</connection-property>
                <connection-property name="APPLICATIONNAME">TestApp</connection-property>
                <connection-property name="IS_CLOSED_TEST">select 1</connection-property>
                <connection-property name="PACKETSIZE">1024</connection-property>
                <driver>SybaseDB</driver>
                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                <pool>
                    <min-pool-size>5</min-pool-size>
                    <initial-pool-size>5</initial-pool-size>
                    <max-pool-size>200</max-pool-size>
                    <prefill>false</prefill>
                    <use-strict-min>false</use-strict-min>
                    <flush-strategy>FailingConnectionOnly</flush-strategy>
                </pool>
                <security>
                    <security-domain>EncryptDBPassword</security-domain>
                </security>
                <validation>
                    <check-valid-connection-sql>select 1</check-valid-connection-sql>
                    <use-fast-fail>true</use-fast-fail>
                </validation>
                <timeout>
                    <blocking-timeout-millis>15000</blocking-timeout-millis>
                    <idle-timeout-minutes>30</idle-timeout-minutes>
                </timeout>
                <statement>
                    <track-statements>false</track-statements>
                </statement>
            </datasource>
            <drivers>
                <driver name="SybaseDB" module="jdbc.jconn4"/>
            </drivers>
        </datasources>
    </subsystem>

Could anyone please help me whether I am missing an attribute in datasource definition which gives me this error.

sridhar
  • 1,117
  • 5
  • 31
  • 59
  • I'm only marginally familiar with SyBase however you might try changing you flush-strategy to IdleConnections: IdleConnections – sagneta Mar 18 '16 at 17:49
  • Please provide your `TestConnection.java` class. – António Ribeiro Mar 19 '16 at 17:01
  • @Sagneta .. many thanks for the response. I have a doubt here.. If 'IdleConnections' is used, assume there is a stale connection, will this stale connection get removed instantty when the server identifies it is stale OR after time mentioned in 'idle-timeout-minutes'. How do you see 'EntirePool' ? – sridhar Mar 22 '16 at 11:16
  • @ariberio.. many thanks for the response. I had verified and connections are closed properly in the application. It was running fine in JBoss 6 AS and I am not aware whether I have configured properly in Wildfly as I got the output from IronJacmar tool and with that, flush-strategy value is 'FailingConnectionOnly'. – sridhar Mar 22 '16 at 11:17
  • Hi @sridhar , did you solve this issue?, I am facing the same exception, on wildfly 10 – jorgevasquezang Oct 19 '16 at 19:03
  • Hello Ricco, it got solved by using "IdleConnections" flush strategy. Just adding a link I referred.http://www.ironjacamar.org/doc/userguide/1.1/en-US/html/ch05.html You can give a try. – sridhar Oct 20 '16 at 05:23

0 Answers0