I had a strange production problem. Environment:
- JBOSS 4.0.2
- SQL Server 2005
- JTDS 1.2.5 driver
From time to time, the following scenario occurs.
SQL command cannot invoke with
java.sql.SQLException: I/O Error: Read timed out
(I can live with it if this happens only twice a day or so)
But from now on, the connection seems to have disappeared without a pool recognizing it, as I constantly get
java.sql.SQLException: Invalid state, the Connection object is closed.
from this moment. The only thing that helps is restarting JBOSS. This happens despite the fact that I have
<check-valid-connection-sql>select getdate()</check-valid-connection-sql>
configured in my Datasource definition.
I was wondering if I can use a special ValidConnectionChecker, which either rebuilds the connection itself or explicitly throws an exception to fix this. Maybe someone has other suggestions.
Here is my complete definition of DS.
<local-tx-datasource> <jndi-name>MyDS</jndi-name> <connection-url>jdbc:jtds:sqlserver://192.168.35.235:1433/MyDb;user=user1;password=pwd;appName=MyApp;loginTimeout=15;socketTimeout=120</connection-url> <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class> <user-name>user1</user-name> <password>pwd</password> <min-pool-size>10</min-pool-size> <max-pool-size>25</max-pool-size> <blocking-timeout-millis>60000</blocking-timeout-millis> <idle-timeout-minutes>1</idle-timeout-minutes> <check-valid-connection-sql>select getdate()</check-valid-connection-sql> </local-tx-datasource>
Any help is appriciated.
Hi
source share