I have a VC service program accessing a
continously accessing SQL 2K database.
It selects the records from a table that have
a flag set to 1, processes an external funcion,
sets the flag to 0, and process the remaining
records set with 1. Once all the selected records
are processed, the selection is done again.
There is a pseudo code below...
Every once in a while, my service receives an
error saying:
Connection failed:
SQLState: '01000'
SQL Server Error: 6
[Microsoft][ODBC SQL Server Driver][Shared Memory]
ConnectionOpen (Connect())'
Connection failed:
SQLState: '08001'
SQL Server Error:6
[Microsoft][ODBC SQL Server Driver][Shared Memory]
Specified SQL Server not found
This is followed by an ODBC Dialog
I'm not sure what is causing this error. I am
accessing the database more than once every
second. Once I select and hit OK, the
service continues to work like a charm.
What can I do to handle this error?
I did read about SetLoginTimout, but since
I'm only using CDatabase:Open once, I'm only
required to login once. Below is a pseudo code
of my source code in Visual C++
Begining of thread...
CDatabase myDB
myDb.OpenEx ("DSN=xxxx", CDatabase:noOdbcDialog)
CRecordset myRs (&myDB);
while (bServiceIsRunning)
{
myRS.Open (dynaset, "Select All records with Flag =1")
while (!myRS.IsEof && myRS.IsOpen && bServiceIsRunning)
{
run external functions
Set Flag to 0 using myDB->ExecuteSQL
}
if (myRS.IsOpen) myRS.Close
if (myDB.IsOpen) myDB.CloseQuote:}
...end of thread