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