I have the VFP Online help opened - and was just looking at SQLConnect vs. SQLStrinConnect. I will look at the " Managing Connections with SQL Pass-Through topic" as you suggested right now.
-K- -----Original Message----- From: ProfoxTech [mailto:[email protected]] On Behalf Of Richard Kaye Sent: Friday, July 24, 2015 10:14 AM To: [email protected] Subject: RE: Connecting to SQL via VFP w/Failover... If there is a connection in a VFP DBC, checkout the DispWarnings property. And then there's the Managing Connections with SQL Pass-Through topic on the help file which you might find helpful. -- rk -----Original Message----- From: ProfoxTech [mailto:[email protected]] On Behalf Of Kurt Wendt Sent: Friday, July 24, 2015 10:10 AM To: [email protected] Subject: Connecting to SQL via VFP w/Failover... Hello Fellow ProFoxers, So, it recently came to my attention here at work that they have this Disaster Recovery location in Albany. And, the Server here in Manhattan gets Mirrored to a server in Albany. For this one system - which I am now in charge of supporting - there is code to allow it to switch over (like the Failover in .Net) to this Albany server. But, when one of the systems guys recently tested the App on a Sat - by "shutting" down our Manhattan server - it didn't switch over to the Albany server. More specifically - this is what happened. When the App tried to connect to the NYC server - it popped up a nasty error message on the screen(Connection failed: SQL State...). Then, if you hit OK - you get this "SQL Server Login" pop-up window. The trick is - when you get to that "SQL Server Login" pop-up window - if you just hit Cancel - then the app will proceed to connect to the Alternate server in Albany. However, the systems guy - he wants to Avoid getting Error window and the "SQL Server Login" pop-up window. He is asking me to somehow trap for that situation - then handle it behind the scenes to then connect to the alternate server automatically. Well - I tried doing something like that. I used the PING command - by stealing code from another one of our Apps - and implemented it in this App I need to support. So - I just pinged to see if the Server was up. I tested by F-ing up the Server name I was trying to connect to. So - the Ping worked - and after finding the failed Ping - It simply switched to connecting to the other Server. However, the systems guy said that isn't sufficient. He told me that the Server could be Up - but, the Database could be down. So - I can't just Ping the Server and assume that would be sufficient. HE told me that a Database has Two States: Principal & Mirror. As such, I need to have code in place that would handle the situation if the Database is Down completely. Or, it must switch over to the Alternate server in Albany if the Database that's being connected to in NYC has a Status of Mirror instead of Principal. Finally - my question to you all. In the App it's using the SQLStringConnect command from within VFP. But, I know that if this command has a failure - it displays the error as previously mentioned - and then shows "SQL Server Login" pop-up window. I'm also assuming that the control of this SQLStringConnect command is outside the scope of VFP - and that I can't control the display of that error message. Or CAN I??? Also - is there any way to detect the status of the Database - of Principal vs. Mirror? Regards, Kurt Wendt Consultant [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/80838f1ca795b14ea1af48659f35166f1ce...@drexch02.corp.globetax.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

