<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Can someone explain the reasoning behind not reconnecting when an ODBC error code of ‘08003’ or ‘08S01’ is received back in modules/db_unixodbc/dbase.c?<o:p></o:p></p>
<p class="MsoNormal">Such as on lines 120 and 121?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">/* Connection broken */<o:p></o:p></p>
<p class="MsoNormal">if( !strncmp((char*)sqlstate,"08003",5) ||<o:p></o:p></p>
<p class="MsoNormal">!strncmp((char*)sqlstate,"08S01",5) ) {<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:36.0pt">ret = reconnect(_h);<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:36.0pt">if( !SQL_SUCCEEDED(ret) ) return ret;<o:p></o:p></p>
<p class="MsoNormal">} else {<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:36.0pt">return ret;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Those error codes equate to Communication link failure and Connection not open both of which are easily handled by a reconnect?<o:p></o:p></p>
<p class="MsoNormal">As that logic is used in a few places in dbase.c I figure there must be a reason to exclude those errors from a reconnect, but permit other non-connection related errors to trigger a reconnect?  If the intent was to only allow connection
 based error codes to attempt a reconnect then wouldn’t it make more sense to explicitly define the half dozen or so ODBC connection specific error codes  (the 08xxx range denotes connection related errors) and only permit the ones which could be repaired by
 a reconnect?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">08001 Client unable to establish connection - Can be caused by transient network issue, so a reconnect attempt is valid<o:p></o:p></p>
<p class="MsoNormal">08002 Connection name in use - Reconnect probably wouldnt help here<o:p></o:p></p>
<p class="MsoNormal">08003 Connection not open - Reconnect would reopen connection<o:p></o:p></p>
<p class="MsoNormal">08004 Server rejected the connection - Can be caused by transient network issue such as a reboot, so a reconnect attempt is valid<o:p></o:p></p>
<p class="MsoNormal">08007 Connection failure during transaction  - Can be caused by transient network issue, so a reconnect attempt is valid<o:p></o:p></p>
<p class="MsoNormal">08S01 Communication link failure - Can be caused by transient network issue, so a reconnect attempt is valid<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">ODBC Error code definitions: <a href="https://msdn.microsoft.com/en-us/library/ms714687%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396">
https://msdn.microsoft.com/en-us/library/ms714687%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Of those 6 possible connection related errors only 08002 wouldn’t be helped by a reconnect although a new connection could replace the one its attempting to use…<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>