Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> OCIDescribeAny() difficulties -

OCIDescribeAny() difficulties -

From: news <d_at_d.com>
Date: Mon, 15 Jun 1998 13:41:52 -0500
Message-ID: <6m3qjp$4f0$1@ns15.wwisp.com>


I am working with OCI for the first time and have run into problems with the OCIDecribeAny() function. I am using Oracle 8 Enterprise Edition ( trial ) on WNT 4.0 server. Does anyone have a source code file with an example of OCIDescribeAny() used successfully in its natural habitat ? The runtime error I am getting is an access violation suggesting some pointer difficulties. Here are selected cuts of my source :

// declarations ...
static OCIEnv *OCI_Environment = ( OCIEnv* ) 0;

static OCIServer *OCI_Server    = ( OCIServer* ) 0;
static OCIError  *OCI_Error    = ( OCIError* ) 0;
static OCISvcCtx *OCI_Service_Context = ( OCISvcCtx* ) 0;
static OCIStmt *OCI_Statement_1;
static OCIStmt *OCI_Statement_2;
static OCIDefine *OCI_Define = ( OCIDefine* ) 0; OCIDescribe* OCI_Describe_ITEM_199701 = ( OCIDescribe* ) 0;

 // all the basics ... yadda yadda yadda ... ( initialization )

(void) OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0,

                       (dvoid * (*)(dvoid *, size_t)) 0,
                       (dvoid * (*)(dvoid *, dvoid *, size_t))0,
                       (void (*)(dvoid *, dvoid *)) 0 );

(void) OCIEnvInit( (OCIEnv **) &OCI_Environment, OCI_DEFAULT, (size_t) 0,
(dvoid **) 0 );
(void) OCIHandleAlloc( ( dvoid* ) OCI_Environment, ( dvoid** )
&OCI_Describe_ITEM_199701, OCI_HTYPE_DESCRIBE,   ( size_t ) 0, ( dvoid** ) 0 );
(void) OCIHandleAlloc( (dvoid *) OCI_Environment, (dvoid **) &OCI_Error,
OCI_HTYPE_ERROR,
                   (size_t) 0, (dvoid **) 0);
 // server contexts
(void) OCIHandleAlloc( (dvoid *) OCI_Environment, (dvoid **) &OCI_Server,
OCI_HTYPE_SERVER,
                   (size_t) 0, (dvoid **) 0);

(void) OCIHandleAlloc( (dvoid *) OCI_Environment, (dvoid **)
&OCI_Service_Context, OCI_HTYPE_SVCCTX,
                   (size_t) 0, (dvoid **) 0);

(void) OCIServerAttach( OCI_Server, OCI_Error, (text *)"", strlen(""), 0);
 // set attribute server context in the service context
(void) OCIAttrSet( (dvoid *) OCI_Service_Context, OCI_HTYPE_SVCCTX, (dvoid
*)OCI_Server, (ub4) 0,
                    OCI_ATTR_SERVER, (OCIError *) OCI_Error);

(void) OCIHandleAlloc((dvoid *) OCI_Environment, (dvoid **)&OCI_Session,
(ub4) OCI_HTYPE_SESSION,

     (size_t) 0, (dvoid **) 0);

 // load the user name and the password into the session handle
(void) OCIAttrSet((dvoid *) OCI_Session, (ub4) OCI_HTYPE_SESSION,

                 (dvoid *) username, (ub4) strlen((char *)username),
                 (ub4) OCI_ATTR_USERNAME, OCI_Error);


(void) OCIAttrSet((dvoid *) OCI_Session, (ub4) OCI_HTYPE_SESSION,
(dvoid *) password, (ub4) strlen((char *)password), (ub4) OCI_ATTR_PASSWORD, OCI_Error);
 // login
 checkerr(OCI_Error, OCISessionBegin ( OCI_Service_Context, OCI_Error, OCI_Session, OCI_CRED_RDBMS,

     (ub4) OCI_DEFAULT));
 // attach the session to the service context ?
(void) OCIAttrSet((dvoid *) OCI_Service_Context, (ub4) OCI_HTYPE_SVCCTX,

                   (dvoid *) OCI_Session, (ub4) 0,
                   (ub4) OCI_ATTR_SESSION, OCI_Error);
 // allocate the statement handles
 checkerr(OCI_Error, OCIHandleAlloc( (dvoid *) OCI_Environment, (dvoid **) &OCI_Statement_1,

           OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));  checkerr(OCI_Error, OCIHandleAlloc( (dvoid *) OCI_Environment, (dvoid **) &OCI_Statement_2,

           OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));  // allocate the describe handle
 checkerr( OCI_Error,
HandleAlloc(

       ( dvoid* ) OCI_Environment, 
       ( dvoid** ) &OCI_Describe_ITEM_199701,
       OCI_HTYPE_DESCRIBE, 
       ( size_t ) 0,
       ( dvoid** ) 0 ) );

// THIS STATEMENT PRODUCES THE ACCESS VIOLATION
 //
 //      |
 //      |
 //      |
 //     \|/

 //

 // Describe the item_199701 table
 checkerr( OCI_Error, OCIDescribeAny(

       OCI_Service_Context, 
       OCI_Error,
       ( dvoid* ) "RLD.ITEM_199701",
       15,
       ( ub1 ) OCI_OTYPE_NAME,
       ( ub1 ) OCI_DEFAULT,
       ( ub1 ) OCI_PTYPE_TABLE,
       OCI_Describe_ITEM_199701 ) );

 //
SO WHAT AM I DOING WRONG ? Received on Mon Jun 15 1998 - 13:41:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US