OCIEnv *myenvhp;
OCIError *myerrhp=0;
OCISvcCtx *svchp;
sword ret;
ret=OCIEnvCreate((OCIEnv **)&myenvhp, OCI_DEFAULT, 0,0,0,0,0,0);
ret=OCILogon(myenvhp, myerrhp, &svchp,(unsigned char*) "user"
strlen("user"),(unsigned char*) "passwd", strlen("passwd"),
(unsigned char*) "db", strlen("db"));
checkerr(myerrhp,ret);
But I get an OCI_INVALID_HANDLE error. How do I create a default
environment and connect to oracle?
-Jens
Btw, does anyone know when Oracle are planning to ship OCI samples
written in OCI release 8i with Oracle 8i? All examples are currently
using the old OCI.
Sent via Deja.com http://www.deja.com/
Before you buy.
check e.g. ocidemo81.c in the $ORACLE_HOME/rdbms/demo directory. At least
the OCIInitialize(), OCIEnvInit(), and OCIHandleAlloc() calls are missing.
PD
Jens Lundell <Jens.O....@saic.com> wrote in message
news:8lt9uo$e56$1...@nnrp1.deja.com...
Thanks Peter for having me look at the examples again. It seems like the
examples called oci*.c are all using OCI7 but the other examples are in
fact using OCI8.
-Jens
After creating the environment you need to use OCIHandleAlloc and create
the error handle.
OCIEnv *myenvhp;
OCIError *myerrhp=0;
OCISvcCtx *svchp;
OCIStmt* mystmthp;
ret=OCIEnvCreate((OCIEnv **)&myenvhp, OCI_DEFAULT, 0,0,0,0,0,0);
//create error handle
ret=OCIHandleAlloc(myenvhp, &myerrhp,
(ub4) OCI_HTYPE_ERROR, (size_t) 0, (dvoid **) 0));
ret=OCILogon(myenvhp, myerrhp, &svchp,(unsigned char*) "user"
strlen("user"),(unsigned char*) "passwd", strlen("passwd"),
(unsigned char*) "db", strlen("db"));
checkerr(myerrhp,ret);
//create statement handle
ret=OCIHandleAlloc(myenvhp, &mystmthp,
(ub4) OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
That should do it. Let me know if you have any problems or if you find
out why everytime I execute an insert statement I get this error:
ORA-12571
TNS: Packet Writer Failure
Justice
Jens Lundell wrote:
>
>
> I'm having trouble getting started using OCI release 8i. I'm trying to
> connect using:
>
> OCIEnv *myenvhp;
> OCIError *myerrhp=0;
> OCISvcCtx *svchp;
> sword ret;
>
> ret=OCIEnvCreate((OCIEnv **)&myenvhp, OCI_DEFAULT, 0,0,0,0,0,0);
> ret=OCILogon(myenvhp, myerrhp, &svchp,(unsigned char*) "user"
> strlen("user"),(unsigned char*) "passwd", strlen("passwd"),
> (unsigned char*) "db", strlen("db"));
> checkerr(myerrhp,ret);
>
> But I get an OCI_INVALID_HANDLE error. How do I create a default
> environment and connect to oracle?
>
> -Jens
>
> Btw, does anyone know when Oracle are planning to ship OCI samples
> written in OCI release 8i with Oracle 8i? All examples are currently
> using the old OCI.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
Posted via CNET Help.com
http://www.help.com/
Hi all-
I get this error when I perform a tnsping.
Listener is running
Tns names is set up
I stumbled on this when trying to create a dblink. I was having
problems resolving service name so I went back and reconfigured
my
tnsnames file and my listener.ora files. In testing, I used the
tnsping utility and got this error. Has any body come accross
this
before?
Ragards
Adin