Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How do I use Oracle from a UNIX C++ program (Pro C, OCI, etc)?
If you have the Oracle 7 Server SQL Reference book, look on page
4-147. Or look up in the V8 reference and look for the CONNECT
clause. This should get you started. You need to do something
like the following to connect
to the db using Pro*C:
EXEC SQL BEGIN DECLARE SECTION;
varchar vUsername[NAME_LEN]; varchar vPassword[NAME_LEN]; varchar vDBname[NAME_LEN];
strcpy(vUsername.arr,'scott'); strcpy(vPassword.arr,'tiger'); strcpy(vDBname.arr,'testdb');
EXEC SQL CONNECT :vUsername IDENTIFIED BY :vPassword USING :vDBname;
Don't forget to issue a EXEC SQL COMMIT WORK RELEASE of EXEC SQL ROLLBACK WORK RELEASE when you exit the program.
HTH
T.
In article <3908ad3a.84187304_at_news-east.newscene.com>,
chambers_at_inquiregroup.com (Don) wrote:
>I am writing a middle tier C++ program that will run on a UNIX
system
>(HP-UX) and needs to connect to Oralce. Has anyone had success
with
>this? What is the best way to do it?
>
>I have tried using Pro*C but it does not inetgrate well with our
>development environemnt (SoftBench). There is also very little
>documentation on it and Oracle tech support is no help with
setup
>problems. They just tell me to look at a sample make file.
>
>I am considering using the Orcle Call Interface (OCI) but have
never
>used it.
>
>I can't seem to find many books or any classes for Pro*C or OCI.
>
>Does anyone have any suggestions?
>
>I can use a third party tool if one is available but I would
like to
>be able to use SQL statements if possible.
>
>
>Thanks,
> Don
> chamber_at_mindspring.com
>
>
![]() |
![]() |