Hello Everyone,
Is it possible to determine if FW_OpenAdoConnection is still alive before a FW_OpenRecordSet call and if it is NOT, is there a way to reestablish connection? Here is my sample code establishing connection.
oCn := FW_OpenAdoConnection( "MSSQL,"+xSOURCE+","+xDATABASE2+","+xUSERID+","+XPASSWORD, .T. )
if oCn == nil
? "Failed to connect to Server"
return nil
endif
Thank you!
FW_OpenAdoConnection reconnect
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: FW_OpenAdoConnection reconnect
Please check the value of oCn:State.
If the value is 0, the connection is closed. If the value >= 1 the connection is open and the actual value depends on the current activity.
If oCn is closed we can try reconnect by oCn:Open()
This is a sample code to check the connection status and try to reconnect.
If still the connection can not be re-established, the possible reasons can be loss of internet connection, or physical network issues. This indicates the need for the user to physically remedy the situation and retry the operaration.
If the value is 0, the connection is closed. If the value >= 1 the connection is open and the actual value depends on the current activity.
If oCn is closed we can try reconnect by oCn:Open()
This is a sample code to check the connection status and try to reconnect.
Code: Select all | Expand
function Check( oCn )
if oCn:State == 0
TRY
oCn:Open()
CATCH
? "Can not reconnect"
END
endif
return ( oCn:State > 0 )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Re: FW_OpenAdoConnection reconnect
Thank you Rao
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: FW_OpenAdoConnection reconnect
Code: Select all | Expand
oCn := FW_OpenAdoConnection( "MSSQL,"+xSOURCE+","+xDATABASE2+","+xUSERID+","+XPASSWORD, .T. )
Code: Select all | Expand
oCn := FW_OpenAdoConnection( { "MSSQL", xSOURCE, xDATABASE2, xUSERID, XPASSWORD }, .T. )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: FW_OpenAdoConnection reconnect
Hello Rao
how to specify the port with FW_OpenAdoConnection() ?
Maurizio
how to specify the port with FW_OpenAdoConnection() ?
Maurizio
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: FW_OpenAdoConnection reconnect
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: FW_OpenAdoConnection reconnect
Thank you Rao