Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> issue with the OCIHandleFree method
I have two methods:
A::openConnection()
{
...
occiConn = occiEnv->createConnection(...);
ociEnv = occiEnv->getOCIEnvironment();
ociSvcCtx = occiConn->getOCIServiceContext();
...
OCIHandleAlloc(ociEnv, (void**)&ociError, OCI_HTYPE_ERROR, 0, NULL));
OCIHandleAlloc(ociEnv, (void**)&oci_transaction, OCI_HTYPE_TRANS, 0, 0));
OCIAttrSet(ociSvcCtx, OCI_HTYPE_SVCCTX, oci_transaction, 0,
OCI_ATTR_TRANS, ociError));
...
}
A::closeConnection()
{
...
OCIHandleFree(oci_transaction, OCI_HTYPE_TRANS));
OCIHandleFree(ociError, OCI_HTYPE_ERROR));
occiEnv->terminateConnection(occiConn);
...
}
My program in UNIX (Sun OS) creates connection by calling the openConnection() method and sends some SQL requests. If request cannot be treated (for example due the locked record in the DB) the program tries to reestablish connection by calling the closeConnection() method and after some delay the openConnection() one. In this case my program core dumped in the occiEnv->terminateConnection() method or in the occiEnv->createConnection() one. If I add some delay (some unuseful code) after freeing the transaction handle ( closeConnection() method) the program will work well. So does anybody know that the cause of such behavior? I suggest that the OCIHandleFree() function only starts some thread which really frees the transaction handle and when the occiEnv->terminateConnection() method called the thread is still freeing the transaction handle. But I do not know exactly how the Oracle API internally works. And may by the OCI and OCCI libraries are not compatible with each other and behavior of a program which mixes these libraries is not determined ? Received on Wed Apr 20 2005 - 10:23:59 CDT
![]() |
![]() |