<!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&#160; restart the DB, but I really can't figure it out. I bet I'm missing&#160; something really basic, but can anyone help? We're using spring on top&#160; of jboss.<br/> <br/> Here is what I have in my applicationContext.xml:<br/> <br/> &lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB&#160; ean"&gt; <br/> &lt;property name="jndiName"&gt;&lt;value&gt;java:/MSSQLDS&lt;/value&gt;&lt;/property&gt;<br/> &lt;/bean&gt;<br/> <br/> &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou&#160; rceTransactionManager"&gt;<br/> &lt;property name="dataSource"&gt;&lt;ref local="dataSource"/&gt;&lt;/property&gt;<br/> &lt;/bean&gt;<br/> <br/> And in jtds-ds.xml we have:<br/> <br/> &lt;datasources&gt;<br/> &lt;local-tx-datasource&gt;<br/> &lt;jndi-name&gt;MSSQLDS&lt;/jndi-name&gt;<br/> &lt;connection-url&gt;jdbc:jtds:sqlserver://localhost/dbname;namedPipe=true;tds=8.0;lastupdatecount=true&#160;&#160; ;sendStringParametersAsUnicode=false&lt;/connection-url&gt; <br/> <br/> &lt;driver-class&gt;net.sourceforge.jtds.jdbc.Driver&lt;/driver-class&gt;<br/> &lt;user-name&gt;user&lt;/user-name&gt;<br/> &lt;password&gt;pass&lt;/password&gt;<br/> &lt;check-valid-connection-sql&gt;SELECT 1&lt;/check-valid-connection-sql&gt;&#160;&#160;&#160;&#160;&#160; <br/> &lt;background-validation-minutes&gt;5&lt;/background-validation-minutes&gt;<br/> &lt;/local-tx-datasource&gt;<br/> &lt;/datasources&gt;<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&amp;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&amp;p=318694"><span> http://forum.springsource.org/images/buttons/quote.gif </span></a> <a href="http://forum.springsource.org/newreply.php?do=newreply&amp;p=318694"><span> http://forum.springsource.org/images/buttons/multiquote_off.gif </span></a> <a href="http://forum.springsource.org/newreply.php?do=newreply&amp;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>