JBoss Community

How to Auto-Reconnect jtds on DB restart

created by jboden in Datasource Configuration - View the full discussion
http://forum.springsource.org/images/icons/icon1.gif How to Auto-Reconnect jtds on DB restart

Hi,

I've read that the jtds connection pooling should auto-reconnect if I  restart the DB, but I really can't figure it out. I bet I'm missing  something really basic, but can anyone help? We're using spring on top  of jboss.

Here is what I have in my applicationContext.xml:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB  ean">
<property name="jndiName"><value>java:/MSSQLDS</value></property>
</bean>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou  rceTransactionManager">
<property name="dataSource"><ref local="dataSource"/></property>
</bean>

And in jtds-ds.xml we have:

<datasources>
<local-tx-datasource>
<jndi-name>MSSQLDS</jndi-name>
<connection-url>jdbc:jtds:sqlserver://localhost/dbname;namedPipe=true;tds=8.0;lastupdatecount=true   ;sendStringParametersAsUnicode=false</connection-url>

<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
<user-name>user</user-name>
<password>pass</password>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>     
<background-validation-minutes>5</background-validation-minutes>
</local-tx-datasource>
</datasources>


But if we restart the DB, we then get forever of:

org.jboss.util.NestedSQLException: Unable to get managed connection for MSSQLDS

Can anyone help with an example of how to configure an auto re-connect?

Thanks!

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community