Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Connection

Status
Not open for further replies.
Joined
Feb 14, 2000
Messages
425
Location
US
I am running a Internet wc Server app that relies heavy on ODBC data. To keep connection overhead down to a minimum I init the var=sqlconnect() when the wc server starts up I then reference the var throughout. My problem is when the Unix Box (ODBC Data Source)goes down or is rebooted I lose the connection and this results in an error on the next call. What I am looking for is a method to test the ConnectionHandle from time to time and if it dosn't exsist re-establish it I have tried several different ways to do this and none of them work very well. Any suggestions??
 
My .02,

*Establish an error handler routine
ON ERROR DO ERRORHANDLER WITH ERROR( ), MESSAGE( )
*Allow the user to configure the connection
VAR=SQLCONNECT()
*Store the connection string for subsequent connections
CONSTRING=SQLGETPROP(VAR,'CONNECTSTRING')
*blah
*blah
*blah

PROCEDURE ERRORHANDLER
PARAMETER merror, mess

IF merror=1466 && connection handle is invalid
*Use the connectstring the user configured earlier
VAR=SQLSTRINGCONNECT(CONSTRING)
*Check for success
IF VAR<=0
MESSAGEBOX('Connection cant be established.',0,'Boo!')
ENDIF
ENDIF
ENDPROC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top