Solved

Oracle OCI

Posted on 2003-11-19
2
1,422 Views
Last Modified: 2011-09-20
Hi all,
 
I am currently facing error messages while I do commit after any new updation or insertion in a table using OCI function( OCITransCommit ). Kindly help me in resolving this problem.
 
Below is the error message I am getting :
Fri May 14 08:45:16 1999>>>The ERROR CODE is:24762
Fri May 14 08:45:16 1999>>>The ERROR MSG is:ORA-24762: server failed due to unspecified error
 
whose internal information is

ORA-24762 server failed due to unspecified error
Cause: An internal error has occurred in the server commit protocol.

Action: Contact Oracle Customer Support.

If I try to commit in the sqlplus prompt , its working fine,  but through program I am not able to set.
 
Is there any command or statement to be executed before doing anything with commit. I had created handlers for env,error,server , service , set the attributes of server to service, statement handlers and then tried OCIlogon. Please let me know if I have missed something.
 
Along with this Mail, I have pasted my code for your perusal.
 
OCIEnvCreate((OCIEnv **)&envhp , OCI_DEFAULT, 0, 0, 0, 0, 0, 0);
OCIHandleAlloc((dvoid *)envhp, (dvoid**)&errhp, OCI_HTYPE_ERROR, 0, 0)
OCIHandleAlloc((dvoid *)envhp, (dvoid **)&srvhp, OCI_HTYPE_SERVER, 0, 0)
OCIServerAttach(srvhp,errhp, (text*) "tiscali", strlen("tiscali"), (ub4) OCI_DEFAULT);
OCIHandleAlloc((dvoid *)envhp, (dvoid **)&svchp, OCI_HTYPE_SVCCTX, 0, 0);
OCIHandleAlloc((dvoid *)envhp, (dvoid**)&updateStmt, OCI_HTYPE_STMT, 0, 0);
OCIHandleAlloc((dvoid *)envhp, (dvoid**)&insertStmt, OCI_HTYPE_STMT, 0, 0);
OCIAttrSet((dvoid *)svchp,OCI_HTYPE_SVCCTX,(dvoid *)srvhp,0,OCI_ATTR_SERVER,errhp);
 
all the above statements are returning OCI_SUCESS.
 
void updateRecord(OCISvcCtx* svchp, OCIError* errhp,OCIStmt *updateStmt,unsigned long codeprovseq, char*  flagExported)
{  OCIBind *bndhp1, *bndhp2;
 
char updateQuery[] = "update provisioning_request set flag_exported = :flagExported, tmst_update = sysdate w
here code_provisioning_req_seq  = :codeprovseq and flag_exported = '0'";
 
checkerr(errhp,OCIStmtPrepare(updateStmt, errhp,(OraText*)updateQuery,(ub4) strlen(updateQuery), OCI_NTV_SYNTAX, OCI_DEFAULT));
 
checkerr(errhp, OCIBindByName(updateStmt, &bndhp1, errhp, (text *)":flagExported", (sb4) -1, (dvoid *) flagE
xported, (sb4) strlen(flagExported)+1, SQLT_STR, (dvoid *)0, (ub2 *)0, (ub2 *)0, (ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT));
 
checkerr(errhp, OCIBindByName(updateStmt, &bndhp2, errhp, (text *)":codeprovseq", (sb4) -1, (dvoid *) &codeprovseq, (sb4) sizeof(codeprovseq), SQLT_NUM, (dvoid *)0, (ub2 *)0, (ub2 *)0, (ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT));
 
checkerr(errhp,OCIStmtExecute(svchp, updateStmt, errhp, (ub4) 1, (ub4) 0, (OCISnapshot *) NULL, (OCISnapshot *) NULL, (ub4) OCI_DEFAULT));
/*Till this there is no error getting popped up */

/*failing here */
checkerr(errhp, OCITransCommit(svchp, errhp, (ub4)OCI_TRANS_TWOPHASE));

}
0
Comment
Question by:babuvt
2 Comments
 
LVL 13

Expert Comment

by:anand_2000v
ID: 9779640
Are you using RAC?
0
 
LVL 22

Accepted Solution

by:
earth man2 earned 50 total points
ID: 9796319
try OCI_DEFAULT instead of OCI_TRANS_TWOPHASE

Do you really require a OCI_TRANS_TWOPHASE commit ?

If so your transaction needs to be controlled with the following steps:

1 OCITransStart 1234      OCI_TRANS_NEW    Starts new read-only transaction
2 SQL UPDATE              Update rows
3 OCITransDetach           Transaction is detached
4 OCITransStart 1234      OCI_TRANS_RESUME Transaction is resumed
5 SQL UPDATE
6 OCITransPrepare          Transaction prepared for two-phase commit
7 OCITransCommit          OCI_TRANS_TWOPHASE  Transaction is committed.

ie I guess you are missing steps 3,4,6.

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now