Home » Developer & Programmer » Precompilers, OCI & OCCI » CLOB array
CLOB array [message #226670] Mon, 26 March 2007 02:42
jkolar
Messages: 1
Registered: March 2007
Location: Slovakia
Junior Member

Hi all!

I have following test procedure, that has 1 input parameter of type integer and one output parameter type clob array:

PROCEDURE RTS_TEST(IN_INT IN PLS_INTEGER, OUT_TEXT OUT DIAMETER.CLOB_ARRAY) IS

BEGIN

SELECT t.SD BULK COLLECT INTO OUT_TEXT FROM T_DUPL t WHERE t.SN = 0;
END;

I am developing application based on OCI interface, that is calling this procedure on server, but i get following error:
ORA-3113: End of file on communication channel.

On server i find trace file with following errors:

Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0x8, PC: [0xad1e461, sdtcs_getexecname: use overriding value for executable
sdtcs_getexecname: ignored overriding value [oracleHLR10D]

ORA-07445: exception encountered: core dump [psdgbaa()+1307] [SIGSEGV] [Address not mapped to object] [0x8] [] []

Where is the problem? I am not sure, if i bind output array correctly, but there is not complete example how to use clob array on internet (except following link, but this is not complete source code, on many places are only "...", http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_lob_ops.htm#BACGDAJF)

My source code for binding:
OCIRESULT CORA_Parameter::AllocBuffer(OCIStmt* v_OCIStmt)
{
...
if (m_iElemCount > 0) {
int i;

m_pValSize = (ub2*)malloc(sizeof(ub2)*m_iElemCount);
m_pInd = (sb2*)malloc(sizeof(sb2)*m_iElemCount);
m_pBuffer = malloc(m_iMaxSize*m_iElemCount);
memset(m_pBuffer, 0, m_iMaxSize*m_iElemCount);
memset(m_pValSize, 0, sizeof(ub2)*m_iElemCount);
memset(m_pInd, 0, sizeof(sb2)*m_iElemCount);
m_iMaxElemCount = m_iElemCount;
for(i=0;i<m_iElemCount;i++)
m_pValSize[i] = m_iMaxSize;

if (m_ubDbType == SQLT_CLOB)
{
OCILobLocator * lob_array[ARRAY_SIZE];
OCIRESULT hr;
OCIDefine *hDefine = NULL;
OCIError *hErr = 0;

for (i=0; i<ARRAY_SIZE; i++) /* initialize array of locators */
{
V(OCIDescriptorAlloc(pOCI->GetHEnv(), (void**)&lob_array[i], OCI_DTYPE_LOB, 0, NULL));

if(hr != OCI_SUCCESS) {
SAFE_FREE(m_pBuffer);
SAFE_FREE(m_pValSize);
m_iMaxElemCount = 0;
m_iElemCount = 0;
{
tchar_t sName[OCIE_PAR_NAME_LEN];
tchar_t sProcName[OCIE_PROC_NAME_LEN];
xcstotcs(sName, m_sName, OCIE_PAR_NAME_LEN);
xcstotcs(sProcName, m_pProc->GetName(), OCIE_PROC_NAME_LEN);
#ifdef _UNICODE
pOCI->Log(eLogSev_ERROR, L"%ls(%ls): Could not allocate LOB descriptor ...\n", sProcName, sName);
#else
pOCI->Log(eLogSev_ERROR, "%s(%s): Could not allocate LOB descriptor ...\n", sProcName, sName);
#endif
}
return hr;
}
memcpy((CHAR*)m_pBuffer+i*sizeof(OCILobLocator*),&lob_array[i],sizeof(OCILobLocator*)); // copy OCILobLocator* to m_pBuffer
}
hErr = m_pProc->GetOCI()->GetHErr();
V(OCIDefineByPos(v_OCIStmt, &hDefine, hErr, 2, (dvoid *) lob_array, sizeof(OCILobLocator*), SQLT_CLOB, NULL, 0, 0, OCI_DEFAULT));
//V_R(OCIDefineByPos(hStatement, &hDefine, m_hErr, 1, &xsApp, sizeof(xsApp), SQLT_STR, NULL, 0, 0, OCI_DEFAULT));
if (hr != OCI_SUCCESS)
{
xchar_t errmsg[OCIE_ERR_MSG_LEN];
tchar_t sErrMsg[OCIE_ERR_MSG_LEN];
errmsg[0] = 0;
m_pProc->GetOCI()->GetError(errmsg, sizeof(errmsg));
xcstotcs(sErrMsg, errmsg, OCIE_ERR_MSG_LEN);
#ifdef _UNICODE
m_pOCI->Log(false, eLogSev_DEBUG4, L" Error: %ls\n", sErrMsg);
#else
m_pProc->GetOCI()->Log(false, eLogSev_DEBUG4, " Error: %s\n", sErrMsg);
#endif
return hr;
}
}
}
...
}
...
V(OCIBindByPos(m_pProc->GetStmt(), &m_hBind, m_pProc->GetOCI()->GetHErr(), m_iPos, m_pBuffer, m_iMaxSize, m_ubDbType, m_pInd, m_pValSize, 0, m_iElemCount, pElemCount, OCI_DEFAULT));
...
V(OCIStmtExecute(m_pOCI->GetHSvcCtx(), m_hStmt, m_pOCI->GetHErr(), 10, 0, NULL, NULL, OCI_DEFAULT))

Is this correct?
Previous Topic: Form_success
Next Topic: Compiling with -g option for debug info on solaris
Goto Forum:
  


Current Time: Wed Dec 07 04:54:50 CST 2016

Total time taken to generate the page: 0.10002 seconds