问题描述:

I'm new to socket programming and we have a running MFC client application over the network whose socket for some reason disconnects intermittently at least once a day. It's not a problem with the network because other network apps are running just fine. I noticed something in the logs however, that a database error occurs more or less 10 mins before socket disconnects. Something like :

DB ERROR: ADO Error 1 (s)

select l.LABOID, l.LABOCODE, l.LABOCREDATE, l.LABOTEXT, l.SHORTTEXT, l.LISACCOUNTINGMODE, l.ADDRESS1, l.ADDRESS2, l.POSTALCODE, l.CITY, l.STATE, l.COUNTRY, the . TELEPHON, l.FAX, l.EMAIL, l.TELEPHON2, l.NATIONALCODE, l.FIRSTITEMID, l.ALTERNATECODE, l.LABOSERVICEID, l.STARTVALIDDATE, l.ENDVALIDDATE, l.LOGUSERID, l.LOGDATE, b.DICBINARYID , b.OBJECTLINK, b.OBJECTTYPE, b.DICBINARYTYPE, b.BINARYDATE, b.BINARYMIMETYPE, b.BINARYSIZE, b.LOGUSERID, b.LOGDATE, b.BINARYOBJECT, (select count (*) from d DICT_LABO_TO_DEVICE Where l.LABOID = d.LABOID) as NB_DEVICES from DICT_LABORATORIES l, b DICT_BINARY_DATA Where l.ENDVALIDDATE is null and l.LABOCODE like '%%' and l.LABOID b.OBJECTLINK = (+) and b.DICBINARYTYPE (+) = 1 and b . OBJECTTYPE (+) = 7 AND LABOID IN (1) order by l.LABOCODE

ORA-00936: missing expression of

Error: 0x80040e14

On debug mode, I found out that thread is still running but socket is not connected. I could not pinpoint what caused it to disconnect. Is it advisable to issue a reconnect?

Here's the code block :

if (m_pClientSocket->IsThreadStillRunning())

{

if(m_pClientSocket->m_boSocketConnected)

{

dwNbSent_L = *pdwBufferSize_P;

m_pClientSocket->Write(pbyBuffer_P, *pdwBufferSize_P);

iotResult_L = IOTRANS_RESULT_SUCCESS;

}

else

{

m_pobjSession->Write(MSG_ERROR,TRACE_LOW

,_T("%s Client socket is not connected")

,(LPCTSTR)m_strLastErrFunc);

iotResult_L = IOTRANS_RESULT_FAILED;

SetError(ERROR_SOCKET_NOT_CONNECTED, _T("Client socket is not connected"), m_strLastErrFunc);

}

}

Can anyone give me a jumpstart or a list of items to check to prevent this from happening?

网友答案:

This is most likley not a network error.

The Oracle DB can not parse the SQL statment (leading to error ORA-00938), the ADO Layer on top translates the Oracle error into ADO error 0x80040e14 which simply means 'The command contained one or more errors.'.

This is expected to ba a bug in your application.

What you could do is:

  • Check (debug) your application, on how it creates its SQL statments.
  • Check your database, whether some changes (dropped tables/views or rename/deleted columns) where applied, which the application isn't aware of.
相关阅读:
Top