Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-03135: connection lost contact with setDataBuffer and next(no. of rows)

2933607Apr 21 2015 — edited Apr 21 2015

Hi,

     I have a cursor of 16 columns with datatypes of VARCHAR or NUMBER , I have used setDataBuffer to set the buffers appropriately. Now, when I call next(1000) I am getting an exception "ORA-03135: connection lost contact". But, the connection is not closed from the application side. What could be the possible reason? Please help me out with the same.

The code snippet is

char  mPkidArr[1000][255];

char  mDestMdn[1000][255];

char  mSrcMdn[1000][255];

int     mDlvyType[1000];

int     mProcessId[1000];

int     mPriority[1000];

char  mDvyTime[1000][255];

char  mExpTime[1000][255];

char  mShortCode[1000][255];

int     mDocAckReq[1000];

char mSourceAdd[1000][255];

int mDestSvcId[1000];

int mOrigSvcId[1000];

char mCldNum[1000][255];

int IsDr[1000];

int UmrMsgId[1000];

Statement *stmtselectfield = conn->createStatement("SELECT TO_CHAR(SS.Pkid), SM.DestMDN, SS.SrcMDN, SS.DlvyType, SS.SfmProcessId, SS.Priority,

    TO_CHAR(SS.DefDlvyTime), TO_CHAR(SS.ValidityExpiryTime), SS.ShortCode, SS.DeliveryAckReq, SS.SourceAddr,

    SS.DestSvcId, SS.OrigSvcId, SS.CalledNumber, SS.IsDR, SS.UmrMsgId

    FROM SFMSMS_0 SS, SfmMdnData_0 SM

    WHERE SM.DestMdn = 722898018  AND SS.Fk_DestMDN_Id = 2560003

    ORDER BY SS.timeStamp ASC");  //this is the query formed as per the sample test program

   stmtselectfield->execute();

   ResultSet *resultSet =  stmtselectfield->getCursor(3);

if(resultSet)

{

                                              try

                                             {

                                                    resultSet->setDataBuffer(1,mPkidArr,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(2,mDestMdn,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(3,mSrcMdn,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(4,&mDlvyType,OCCIINT,sizeof(mDlvyType[0]));

                                                    resultSet->setDataBuffer(5,&mProcessId,OCCIINT,sizeof(mProcessId[0]));

                                                    resultSet->setDataBuffer(6,&mPriority,OCCIINT,sizeof(mPriority[0]));

                                                    resultSet->setDataBuffer(7,mDvyTime,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(8,mExpTime,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(9,mShortCode,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(10,&mDocAckReq,OCCIINT,sizeof(mDocAckReq[0]));

                                                    resultSet->setDataBuffer(11,mSourceAdd,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(12,&mDestSvcId,OCCIINT,sizeof(mDestSvcId[0]));

                                                    resultSet->setDataBuffer(13,&mOrigSvcId,OCCIINT,sizeof(mOrigSvcId[0]));

                                                    resultSet->setDataBuffer(14,mCldNum,OCCI_SQLT_STR,BUFFERCOL,ArrSize,NULL,NULL);

                                                    resultSet->setDataBuffer(15,&IsDr,OCCIINT,sizeof(IsDr[0]));

                                                    resultSet->setDataBuffer(16,&UmrMsgId,OCCIINT,sizeof(UmrMsgId[0]));

                                                     while(oracle::occi::ResultSet::DATA_AVAILABLE == resultSet->next(1000) || oracle::occi::ResultSet::STREAM_DATA_AVAILABLE == resultSet->next(1000))

                                                        {

                                                                  for(int i = 0; i < resultSet->getNumArrayRows();i++)

                                                                {

                                                                         //Some app related fields assignment

                                                                }

                                                        }

                                           }

                                          catch (const SQLException& e)

                                          {

                                                        printf("exception %s\n",e.what());

                                                        throw DBException(e.what(), e.getErrorCode());

                                          }

}

stmtselectfield->closeResultSet(resultSet);

conn->terminateStatement(stmtselectfield);

Any suggestions are most welcome

Thanks in advance

Sankeerna

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2015
Added on Apr 21 2015
0 comments
1,023 views