Detecting broken connection to Sybase server.



Hi,

I believe I am supposed to use ct_con_props in order to check the
connection status.

My program looks like the following...

// send command to the database
if ( CS_FAIL == (nRetVal = ct_send(m_pCmd) ) )
{
CS_INT status = CS_CONSTAT_DEAD;
ct_con_props(m_pDatabase->pCnx, CS_GET, CS_CON_STATUS,
NULL, 0, &status);
if(status & CS_CONSTAT_DEAD)
{
// Broken connection...
}
}

// make sure that send worked OK
if (CS_FAIL == (nRetVal = ct_results( m_pCmd, &nRetVal2) ) )
{
CS_INT status = CS_CONSTAT_DEAD;
ct_con_props(m_pDatabase->pCnx, CS_GET, CS_CON_STATUS,
NULL, 0, &status);
if(status & CS_CONSTAT_DEAD)
{
// Broken connection...
}
}


After I unplug the network cable, ct_results and ct_send return CS_FAIL
as expected. However, the ct_con_props reset the status to 0, instead
of indicating the connection is dead by setting the bitmap.

Did I do anything wrong or was I missing something?

Thanks for any help.
Andy

.



Relevant Pages

  • Re: Please Urgent - Update Data Source Problem ???
    ... then there's nothing to submit to the database. ... values that are only assigned by the DB once the update command is executed. ... > the connection. ... > schedule, and they can update the existing schedule, add new schedule ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Re: SET IDENTITY_INSERT tablename ON problem
    ... Try to do next - run SQL profiler and see if ADO Command ... Another way is to use Execute method of ADO connection. ... > database I add a new tmp table with the new structure. ...
    (microsoft.public.vb.database.ado)
  • Re: trying to copy the autonumber from one table to the next
    ... Ok I think I understand...and yes this is an access 2000 database ... OleDbCommand command = new OleDbCommand (sqlString, Connection); ... >support multi statement batch commands (which is different from SQL Server). ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Ent Library Application blocks
    ... couple of common things: A Connection, A Command, and a Container for any ... database and data source types. ... Open a Connection ... Create a Command ...
    (microsoft.public.dotnet.framework.aspnet)