Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI help needed
We use OCIServerAttach and pass the service name as defined in Oracle Net8.
It handles all the socket interfacing. We then followup with repeated
OCIAttrSet calls to set the userid, password and server attribute and then
logon through an OCISessionBegin call, a OCIAttrSet call to set up the
session attribute and then do the actual OCILogon call.
.
"Mike" <mike_at_nospam.com> wrote in message
news:b2VA7.8074$Fx6.3621978_at_typhoon.columbus.rr.com...
> I have to connect to oracle database through OCI (I am using C). I have an
> IP and port. The problem for me is how do I let OCI handles know what file
> descriptor to use?
>
> ocifd = openSocket(ipAddress, portNumber) //*--- open port & return file
> descriptor
>
> wher do I specify ocifd in OCI calls?
>
> if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR,
> (size_t) 0, (dvoid **) 0)) {
> exit (-1);
> }
>
> if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &srvhp,
OCI_HTYPE_SERVER,
> (size_t) 0, (dvoid **) 0)) {
> exit (-1);
> }
>
> if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &svchp,
OCI_HTYPE_SVCCTX,
> (size_t) 0, (dvoid **) 0)) {
> exit (-1);
> }
>
> /* set attribute server context in the service context */
> if (OCIAttrSet( (dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *)srvhp,
> (ub4) 0, OCI_ATTR_SERVER, (OCIError *) errhp)) {
> exit(-1);
> }
>
> if (OCIHandleAlloc((dvoid *) envhp, (dvoid **)&authp,
> (ub4) OCI_HTYPE_SESSION, (size_t) 0, (dvoid **) 0)) {
> Trace(ERROR_LEVEL, "OCI_ERROR: OCIHandleAlloc failed.");
> exit (-1);
> }
>
> etc......
>
> Appreciate your help.
> Mike
>
>
Received on Thu Oct 25 2001 - 19:42:46 CDT