Sql - Connection Problem
-
I am writing a real-time communication software whit VC++7 (App Type is Win32 Console)this is my first experince whit SQL in a heavy program. I Open DataBase with CDataBase.OpenEX() in the beginning of program and Close it in the end.This program must run for several days or weeks each time and in each second i makeseveral transactions using CDataBase.ExecuteSql() and CRecordSet.GetFieldValue() My Question Is, Can I Depend on Validity of Sql Connection for several days(I Guess not!),If not What Kind of Handling Required? I can Not Open and Close DataBase each Time ineed it, Because of Real Time feature of My Program. Yours, Mehrdad:confused:
-
I am writing a real-time communication software whit VC++7 (App Type is Win32 Console)this is my first experince whit SQL in a heavy program. I Open DataBase with CDataBase.OpenEX() in the beginning of program and Close it in the end.This program must run for several days or weeks each time and in each second i makeseveral transactions using CDataBase.ExecuteSql() and CRecordSet.GetFieldValue() My Question Is, Can I Depend on Validity of Sql Connection for several days(I Guess not!),If not What Kind of Handling Required? I can Not Open and Close DataBase each Time ineed it, Because of Real Time feature of My Program. Yours, Mehrdad:confused:
I don't think you can count on the connection remaining open for that long a period if the app is on a different machine than the database. what I did in one of my apps was to check for that specific error that indicates the connection is not open, then try to re-open the connection without sending the user any indication. if the re-open fails, then I let the error message continue as usual My articles www.stillwaterexpress.com BlackDice