<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>&nbsp; </div><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <div style="margin: 5px 0px; padding: 0px; border: 1px solid rgb(204, 204, 204); height: 0px; line-height: 0; font-size: 0px;" class="hr" contentEditable="false" readonly="true"></div>  <font size="2" face="Arial"> <b><span style="font-weight: bold;">From:</span></b> Kenneth Brody &lt;kenbrody@spamcop.net&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Richard Hane &lt;yoresoft@sbcglobal.net&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> filepro support &lt;fpsupport@fptech.com&gt;; fplist &lt;filepro-list@lists.celestial.com&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June 5,
 2013 4:38 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: Syntax question<br> </font> </div> <div class="y_msg_container">
On 6/5/2013 4:33 PM, Richard Hane wrote:<br>&gt;&gt; fpODBC 1.0.15<br>&gt;&gt; <br>&gt;&gt; DSN = fp-sqlserver<br>&gt;&gt; <br>&gt;&gt; Which one of the following two lines is correct?&nbsp; Both pass syntax check<br>&gt;&gt; and will run when tested.<br>&gt;&gt; <br>&gt;&gt; Connection = new ODBC_CONNECTION("fp-sqlserver")<br>&gt;&gt; <br>&gt;&gt; or<br>&gt;&gt; <br>&gt;&gt; Connection = new ODBC_CONNECTION("fp-sqlserver ; ")<br>&gt;&gt; <br>&gt;&gt; The question has to do with the semi colon at the end of the statement.<br>&gt;&gt; <br>&gt;&gt; I am still trying to resolve why the connection sometimes fails.&nbsp; Then if<br>&gt;&gt; you immediately run it again it works correctly.<br></div><div class="y_msg_container">Ken,</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">Thanks for replying.&nbsp; I was getting very frustrated.&nbsp; I have fallen in love with the low level ODBC.&nbsp; My processes use to take me 2 hours a
 day.&nbsp; The new batch file tested last night only takes 22 minutes.&nbsp; It is great.&nbsp; I was about to close this project but the problem I described would not allow me to make this process automatic via a scheduled task run at night.</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">&gt; filePro doesn't do any "syntax check" on the value that you pass to NEW ODBC_CONNECTION(), as the data can contain driver-</div><div class="y_msg_container">&gt; specific information. Both of the above statements are valid filePro syntax, regardless of whether the DSN is valid or not.&nbsp; The value </div><div class="y_msg_container">&gt; you give is passed as-is to the ODBC library.<br>&gt;<br></div><div class="y_msg_container">I am sorry.&nbsp; I knew this and just was not thinking.</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">&gt; Note that all of my tests use something like "DSN=fp-sqlserver;" rather
 than just the raw "fp-sqlserver".&nbsp; However, if your value </div><div class="y_msg_container">&gt; works most of the time, then it must be valid to use that syntax.<br><br>I typed to fast yesterday when I sent this email.&nbsp; I do have the 'DSN=' in my defined ODBC source.</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">[ snip ]</div><div class="y_msg_container">Now, as to why it sometimes fails...<br><br>&gt; Obviously, if you pass the same DSN, and it works most of the time, but fails sometimes (and works if you try it a few seconds </div><div class="y_msg_container">&gt; later), then it's probably either a network or a timing issue.<br>&gt;</div><div class="y_msg_container">&gt; Have you considered checking the @ODBCERROR[] system array to see what it says failed?&nbsp; That might point you to the root</div><div class="y_msg_container">&gt;&nbsp;cause.<br>&gt;<br>&gt; Also, if you know that it will work if you wait a
 few seconds and try it again, consider doing that in your processing.&nbsp; That is, if </div><div class="y_msg_container">&gt; NEW ODBC_CONNECTION() fails, use SLEEP to wait a few seconds, and try creating the connection again.&nbsp; (If this is interactive, &gt; perhaps use a SHOW POPUP to display a message to the user, to let them know what's going on.)&nbsp; You may want to put a counter in &gt; there, to limit the number of retries, in case it's not a transient error that time.<br>&gt;<br>&gt; -- Kenneth Brody</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">You are probably correct.&nbsp; Most responses I received from SQL programmers on my MRP users group also said that is what it sounded like.&nbsp; I will set up and try the SLEEP command today.&nbsp; I'll report the results back to the list in case anyone else has the same situation.</div><div class="y_msg_container">&nbsp;</div><div
 class="y_msg_container">BTW...&nbsp; I do use the 2 lines that are to report if the connection isn't found and report what the reason is.&nbsp; The first list displays the 'Show' statement.&nbsp; But I never see the 2nd line.</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">Thanks again.&nbsp; I think this will solve the problem.</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">Rick Hane</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">&nbsp;</div><div class="y_msg_container">&nbsp;</div> </div> </div>  </div></body></html>