Home » Developer & Programmer » Precompilers, OCI & OCCI » OCI Cursor leaking (ORA-01000)
OCI Cursor leaking (ORA-01000) [message #132356] Fri, 12 August 2005 02:28 Go to next message
ntt68
Messages: 1
Registered: August 2005
Junior Member
Hi All,

I can't figure out why Oracle OCI leaves cursors open when executing the following:
OCIHandleFree does not close the cursor which is used to execute the PL/SQL function. The cursors are closed only when I close the DB connection but I want to keep it open.
Does anybody have any idea or ever experience this kind of problem ?
Please advise, thanks in advance.

Platform: HP 9000 UX
Oracle version: 9.2.0.4.0
Compiler: Microfocus procob

Please cc your answers to tantrung68@yahoo.fr

int oci_status,iStatus,iRetval = PSR_OK;
OCIStmt *stmt;
const char *stmt_str;
char szInfoMsg[4000],szIPAddress[400],szPortNr[200],szFields[10];

stmt = NULL;
stmt_str = "BEGIN :msg := GET_FLIGHT_MSG(:fl_id,:fields,:info_msg,:ip_address,:port_nr); END;";

oci_status = OCIHandleAlloc (globals.oci2_env,
(void **) &stmt,
OCI_HTYPE_STMT,
0,
NULL);
LOG_ORACLE_STATUS (oci_status, NULL);
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIStmtPrepare (stmt,
globals.oci2_err,
(void *) stmt_str,
strlen (stmt_str),
OCI_NTV_SYNTAX,
OCI_DEFAULT);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
if (OCI_SUCCESS == oci_status)
{
OCIBind *bnd_msg;
OCIBind *bnd_fl_id;
OCIBind *bnd_fields;
OCIBind *bnd_info_msg;
OCIBind *bnd_ip_address;
OCIBind *bnd_port_nr;
char szFlightID[9];
long lFlightID;

strcpy(szFields,szMsg+8);
strncpy(szFlightID,szMsg,8);
szFlightID[9] = 0;
lFlightID = atol(szFlightID);
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIBindByName (stmt, &bnd_msg, globals.oci2_err,
(void *) ":msg", -1, szMsg,
4000, SQLT_STR, NULL, NULL, 0, 0, NULL,
OCI_DEFAULT);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
}
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIBindByName (stmt, &bnd_fl_id, globals.oci2_err,
(void *) ":fl_id", -1, &lFlightID,
sizeof (lFlightID),
SQLT_INT, NULL, NULL, 0, 0, NULL,
OCI_DEFAULT);
}
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIBindByName (stmt, &bnd_fields, globals.oci2_err,
(void *) ":fields", -1, szFields,
strlen (szFields) + 1,
SQLT_STR, NULL, NULL, 0, 0, NULL,
OCI_DEFAULT);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
}
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIBindByName (stmt, &bnd_info_msg, globals.oci2_err,
(void *) ":info_msg", -1, szInfoMsg,
4000, SQLT_STR, NULL, NULL, 0, 0, NULL,
OCI_DEFAULT);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
}
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIBindByName (stmt, &bnd_ip_address, globals.oci2_err,
(void *) ":ip_address", -1, szIPAddress,
400, SQLT_STR, NULL, NULL, 0, 0, NULL,
OCI_DEFAULT);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
}
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIBindByName (stmt, &bnd_port_nr, globals.oci2_err,
(void *) ":port_nr", -1, szPortNr,
200, SQLT_STR, NULL, NULL, 0, 0, NULL,
OCI_DEFAULT);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
}
if (OCI_SUCCESS == oci_status)
{
oci_status = OCIStmtExecute (globals.oci2_svc_ctx, stmt,
globals.oci2_err, 1, 0, NULL, NULL,
OCI_COMMIT_ON_SUCCESS);
LOG_ORACLE_STATUS (oci_status, globals.oci2_err);
}
}
OCIHandleFree (stmt, OCI_HTYPE_STMT);
}


[Updated on: Fri, 12 August 2005 09:15]

Report message to a moderator

Re: OCI Cursor leaking (ORA-01000) [message #140179 is a reply to message #132356] Sat, 01 October 2005 22:05 Go to previous message
javaman775
Messages: 1
Registered: October 2005
Junior Member
I have the same problem using Sun 5.8 with Oracle's versions: 9.2.0.3, 9.2.0.4 in 32 and 64 bits.

I think at this point that this is an Oracle bug.

I also used OCIStmtPrepare2 and Release functions with the same results.

If you come across with the answer of this issue, please let me know

Thanks,
john
Previous Topic: Retreving both client and server version using OCI ...
Next Topic: ORA-01480 error while inserting into table
Goto Forum:
  


Current Time: Sat Nov 23 20:31:04 CST 2024