Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Oracle database connectivity using C or C++

Vasudevan MV
Frequent Advisor

Oracle database connectivity using C or C++

Hi,

Can anyone tell me, how can I connect oracle database using C or C++ on HP-UNIX?. Is there any reference document or link? .

Thanks in advance.
Regards,
Vasu
6 REPLIES
Sundar_7
Honored Contributor

Re: Oracle database connectivity using C or C++

Are u looking PRO*C or something ?
Learn What to do ,How to do and more importantly When to do ?
A. Clay Stephenson
Acclaimed Contributor

Re: Oracle database connectivity using C or C++

While at a very limited level you could use popen() or system() to execute a sql script and capture the output, the real method is to use Oracle's ProC that will allow you to embed SQL statements inside your C or C++ code.
If it ain't broke, I can fix that.
malay boy
Trusted Contributor

Re: Oracle database connectivity using C or C++

Agreed we used ProC here to build our application and connect to oracle database.
There are three person in my team-Me ,myself and I.
Vasudevan MV
Frequent Advisor

Re: Oracle database connectivity using C or C++

Thanks for your replies.

I am not looking for pro C, looking for some kind of library through which we can connect to oracle database using C or C++.

Note: I had posted this question yesterday night, so I could not assign the points. Is there any otherway to assign the points?

Regards,
Vasu
Indira Aramandla
Honored Contributor

Re: Oracle database connectivity using C or C++

Hi Vasu,

Pro*C/C++, precompilers connect to oracle database using embedded sql statement connect.

Example:-

EXEC SQL CONNECT :uid IDENTIFIED BY :pwd;

SQLLDAGetCurrent(&lda);

EXEC SQL EXECUTE
BEGIN
------ END;
END-EXEC;

Oracle supports
· C, by means of the Oracle Call Interface (OCI), as described in the Oracle Call Interface Programmer's Guide

· C++, by means of the Pro*C/C++ precompiler, as described in the Pro*C/C++ Precompiler Programmer's Guide.

Demo programs are located in
$ORACLE_HOME/precomp/demo/proc directory.

I hope this helps

Indira
Never give up, Keep Trying
Blueao
Occasional Visitor

Re: Oracle database connectivity using C or C++

If I want to connect to the Oracle Database which is installed in different host, how can I
write this sentence:
EXEC SQL CONNECT :uid IDENTIFIED BY :pwd;
?