Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check from client if ORACLE service is running
Message
From
22/02/2002 11:30:24
 
 
To
21/02/2002 22:57:40
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00623554
Message ID:
00623745
Views:
10
>Hi All,
>
>Does anyone have an idea how can i test to see if my ORACLE 8i database is running?
>I need to know that before i try to connect so my app doesn't crash.
>
>
>
>Thanks
>
>Dejan

When you use either SQLCONNECT or SQLSTRINGCONNECT, you should be able to test the return value of the connection handle. If it is < 0, the connection was not made.

If you've already made a connection, testing it before use is a little harder. For SQL Server, I do the following:
	PROCEDURE test_connection(tnHandle)
                * tnHandle is the number of the connection handle

		LOCAL lcOnError, llError

		* turn the error handler off
		lcOnError = ON("ERROR")

		ON ERROR llSuccess = .f.
		
		llSuccess = SQLEXEC(tnHandle, "select 1")
		
		* restore the regular error handler
		ON ERROR &lcOnError
		
		RETURN llSuccess
	ENDPROC
Hope that helps.
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform