<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
<table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tbody>
<tr>
<td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
<h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
<!-- To have a header image/logo replace the name below with your img tag -->
<!-- Email clients will render the images when the message is read so any image -->
<!-- must be made available on a public server, so that all recipients can load the image. -->
<a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
How to Auto-Reconnect jtds on DB restart
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/jboden">jboden</a> in <i>Datasource Configuration</i> - <a href="http://community.jboss.org/message/561410#561410">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><table align="center" border="0" cellpadding="6" cellspacing="1" class="tborder" id="post318694" width="100%"><tbody><tr></tr><tr><td class="alt1" id="td_post_318694" style=""><div class="smallfont"><a href="http://forum.springsource.org/images/icons/icon1.gif"><span> http://forum.springsource.org/images/icons/icon1.gif </span></a> <strong>How to Auto-Reconnect jtds on DB restart</strong></div><hr size="1" style="color: #d1d1e1; background-color: #d1d1e1;"/><div id="post_message_318694">Hi,<br/> <br/> 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.<br/> <br/> Here is what I have in my applicationContext.xml:<br/> <br/> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB  ean"> <br/> <property name="jndiName"><value>java:/MSSQLDS</value></property><br/> </bean><br/> <br/> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou  rceTransactionManager"><br/> <property name="dataSource"><ref local="dataSource"/></property><br/> </bean><br/> <br/> And in jtds-ds.xml we have:<br/> <br/> <datasources><br/> <local-tx-datasource><br/> <jndi-name>MSSQLDS</jndi-name><br/> <connection-url>jdbc:jtds:sqlserver://localhost/dbname;namedPipe=true;tds=8.0;lastupdatecount=true   ;sendStringParametersAsUnicode=false</connection-url> <br/> <br/> <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class><br/> <user-name>user</user-name><br/> <password>pass</password><br/> <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>      <br/> <background-validation-minutes>5</background-validation-minutes><br/> </local-tx-datasource><br/> </datasources><br/> <br/> <br/> But if we restart the DB, we then get forever of: <br/> <br/> org.jboss.util.NestedSQLException: Unable to get managed connection for MSSQLDS<br/> <br/> Can anyone help with an example of how to configure an auto re-connect?<br/> <br/> Thanks!</div><div align="right" style="margin-top: 10px;"><a href="http://forum.springsource.org/images/misc/progress.gif"><span> http://forum.springsource.org/images/misc/progress.gif </span></a> <a href="http://forum.springsource.org/editpost.php?do=editpost&p=318694" name="vB::QuickEdit::318694"><span> http://forum.springsource.org/images/buttons/edit.gif </span></a> <a href="http://forum.springsource.org/newreply.php?do=newreply&p=318694"><span> http://forum.springsource.org/images/buttons/quote.gif </span></a> <a href="http://forum.springsource.org/newreply.php?do=newreply&p=318694"><span> http://forum.springsource.org/images/buttons/multiquote_off.gif </span></a> <a href="http://forum.springsource.org/newreply.php?do=newreply&p=318694"><span> http://forum.springsource.org/images/buttons/quickreply.gif </span></a></div></td></tr></tbody></table></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/561410#561410">going to Community</a></p>
<p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>