need some OCL help

need some OCL help

Postby youngmin » Tue 16 Sep 2008 07:28

I am using OCL library with Visual C++6. We are testing this program with 9i and 10g.
I noticed sometimes the server connection is disconnected, and even OCL function "isConnected()" is not reconized it.

this is the function that I have the problem.


BOOL CVDoc::UpdateMovPrograssive(LPCSTR strTelnumber, LPCSTR strGroupID, int nTotNum, int nFileNum, LPCSTR strFileName, LPCSTR strRTN, LPCSTR strAttr, LPCSTR strProgress)
{
if(!(m_Connection.isConnected()))
{
_WriteMessage(_WR_MSG_ERR_, _T("CVDoc::UpdateMovPrograssive : DB is Disconnected"));
return FALSE;
}

OraCommand cmd;

try
{
cmd.setConnection(m_Connection);
cmd.createProcCall(_T("UPDATE_MOVIE_DOWN_PROGRESS"));
cmd.param("in_telnumber").setChars(strTelnumber);
cmd.param("in_group_id").setChars(strGroupID);
cmd.param("in_total").setInt(nTotNum);
cmd.param("in_order").setInt(nFileNum);
cmd.param("in_filename").setChars(strFileName);
cmd.param("in_state").setChars(strAttr);
cmd.param("in_result").setChars(strRTN);
cmd.param("in_percent").setChars(strProgress);
cmd.execute();
}
catch (CRException& e)
{
CString strMessage = _T("CVDoc::UpdateMovPrograssive : ");
_WriteMessage(_WR_MSG_ERR_, strMessage + CString(e.message()));

return FALSE;
}

return TRUE;
}



since this program run, sometimes program is just sutdowned. even connection is failed is shouldn't happened.
Anyway. the message said. it is accessed the wrong memory point. it happend in OCL library.
It normaly working well. but sometimes, it failed, and I realzed that at that moment, the connection is not really connected. so It the procedure couldn't run.

My question is.

1) How can I realized that it is not connected. is "OraConnection::isConnected()" only way can get it?
2) Do you have any idea why it is happend? I am a beginner, I need experts helps...
youngmin
 
Posts: 3
Joined: Tue 16 Sep 2008 07:26

Postby Paul » Wed 17 Sep 2008 08:41

There is no way in Oracle to determine if a connection is broken. OCI does not have such functionality. When the connection is broken, the next command execution returns an error. You can determine this situation by executing any simple command that does not affect data ("COMMIT" for example).
Function "isConnected()" returns the current state of OraConnection object and does not know anything about network socket state.
Can you reproduce "access the wrong memory point" error on a small application? What is your OCL version? Send us please small demo project to demonstrate the problem
and include script to create server objects (procedures, tables).
Paul
 
Posts: 725
Joined: Thu 28 Oct 2004 14:06

I noticed the reason...

Postby youngmin » Wed 17 Sep 2008 09:43

Our OCL version is 3.20.0.7 and we bought couple of month a go...

I realized that it is not the connection problem.

when it excuted a procedure, before finished the procedure, if I run same function, it means same procedure. it is crushed.
I traced the OCL function it has mutex, so i think, there is no reason for crushed the program.

If program dead with debugging meaasge, I would happy with it. but even debbuging mode, app program just shut downed without any message box.

I just debugged with file writing, and I found the reason.

when this function called before it finished the process, If I call again. it will happend
------------------------------------------------------------------------

BOOL CVDoc::UpdateECardPrograssive(LPCSTR strTelnumber, LPCSTR strGroupID, int nTotNum, int nFileNum, LPCSTR strFileName, LPCSTR strRTN, LPCSTR strAttr, LPCSTR strProgress)
{
CFunctionCkClass f(_T("CVDoc::UpdateECardPrograssive() : %s"));

if(!IsDBConnected())
{
_WriteMessage(_WR_MSG_ERR_, _T("CVDoc::UpdateE_CardPrograssive : DB 가 연결되어있지 않습니다."));
return FALSE;
}

OraCommand cmd;

try
{
cmd.setConnection(m_Connection);
cmd.createProcCall(_T("UPDATE_CARD_DOWN_PROGRESS"));
cmd.param("in_telnumber").setChars(strTelnumber);
cmd.param("in_group_id").setChars(strGroupID);
cmd.param("in_total").setInt(nTotNum);
cmd.param("in_order").setInt(nFileNum);
cmd.param("in_filename").setChars(strFileName);
cmd.param("in_state").setChars(strAttr);
cmd.param("in_result").setChars(strRTN);
cmd.param("in_percent").setChars(strProgress);
cmd.execute();
}
catch (CRException& e)
{
CString strMessage = _T("CVDoc::UpdateE_CardPrograssive : ");
_WriteMessage(_WR_MSG_ERR_, strMessage + CString(e.message()));

return FALSE;
}

return TRUE;
}

----------------------------





and this is the procedure
------------------------------------------------------------------------
create or replace procedure update_card_down_progress(in_telnumber VARCHAR2, in_group_id VARCHAR2,
in_total number, in_order number, in_filename varchar2,in_state VARCHAR2, in_result VARCHAR2, in_percent VARCHAR2)
IS
begin
if in_state = '1' then /* 정상 응답 */
begin
update tbl_deploy_card_current set dcc_deploy_progress = in_result, dcc_deploy_percent = in_percent
, dcc_deploy_end_date = to_char(sysdate, 'yyyymmddhh24mi')
where em_tel = in_telnumber and dcc_group_id = in_group_id and dcc_order = in_order;
end;
else
begin
update tbl_deploy_card_current set dcc_deploy_progress = in_result, dcc_deploy_percent = in_percent, dcc_deploy_error = in_state
, dcc_deploy_end_date = to_char(sysdate, 'yyyymmddhh24mi')
where em_tel = in_telnumber and dcc_group_id = in_group_id and dcc_order = in_order;
end;
end if;

/* 모든 전송이 완료 되었는지 검사한다. */
/*if in_result = '1' or in_result = '4' or in_result = '5' then
if in_total = in_order then */
/* 단말기이 현재 값을 group id 의 목록으로 변경한다. */
/*update_card_download(in_telnumber, in_group_id);
insert_card_down_completed(in_telnumber, in_group_id, in_order);
end if;
end if;*/
commit;
end;
--------------------
youngmin
 
Posts: 3
Joined: Tue 16 Sep 2008 07:26


Return to dbForge for Oracle