[jboss-user] [Datasource Configuration] - How to Auto-Reconnect jtds on DB restart

Jim Boden do-not-reply at jboss.com
Fri Sep 10 21:46:19 EDT 2010


jboden [http://community.jboss.org/people/jboden] created the discussion

"How to Auto-Reconnect jtds on DB restart"

To view the discussion, visit: http://community.jboss.org/message/561410#561410

--------------------------------------------------------------
|
|  http://forum.springsource.org/images/icons/icon1.gif  (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!
 http://forum.springsource.org/images/misc/progress.gif  (http://forum.springsource.org/images/misc/progress.gif)  http://forum.springsource.org/images/buttons/edit.gif  (http://forum.springsource.org/editpost.php?do=editpost&p=318694)  http://forum.springsource.org/images/buttons/quote.gif  (http://forum.springsource.org/newreply.php?do=newreply&p=318694)  http://forum.springsource.org/images/buttons/multiquote_off.gif  (http://forum.springsource.org/newreply.php?do=newreply&p=318694)  http://forum.springsource.org/images/buttons/quickreply.gif  (http://forum.springsource.org/newreply.php?do=newreply&p=318694) |
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/561410#561410]

Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100910/d5daca86/attachment-0001.html 


More information about the jboss-user mailing list