Saturday, February 25, 2012

Communication Link Failure C++ & SQL Server

Hi Guys,

I am using C++ (Ver 6) that connects to a SQL Server 7 DB using ODBC drivers. The apps connects to the database in the start and listens to the users requests and replies with the required data.

The apps is working fine, but once in a while it looses connection and gives "Communication link failure" message.

I just restart the apps and it is able to reconnect and perform as normal without any problems.

I am not able to find the reason as this behaviour as its very much unpredictable!

The error is returned by SQLExecDirect() function.

The question is, since I still have the Connection Handle, is it possible to just reconnect to the database re-using the same handle ? or do I have any other choices ?

Thanks in advance.
Faisal.This is the wrong forum to ask this question. Try one of the SQL forums.|||You might get this error when the server gets restarted. I look for error 0x80004005 and reconnect to the server, it has worked well.

I'll move this thread to the SQL forum for a better answer.
|||

Hi Brian,

I think my question was confusing. I actually meant, how to re-connect to the DB using the same Connection Handle ? I am new to C/C++

Thanks.|||

Thanks for the help. As I mentioned above, I am new to C/C++ and dont know how to reuse the same connection handle. So that I dont need to re instantiate all the other classes that are using a reference to that connection handle

Hope you can help me out here.

No comments:

Post a Comment