How to connect to oracle using 'C' [message #93807] |
Sun, 02 February 2003 13:16 |
ezhilan
Messages: 5 Registered: February 2003
|
Junior Member |
|
|
Sir,I would like to know how to connect to oracle using 'C'.I am also in need of a sample source code.
Also I need a brief description about precompliers.
|
|
|
Re: How to connect to oracle using 'C' [message #93819 is a reply to message #93807] |
Wed, 05 February 2003 02:18 |
Thotakura
Messages: 9 Registered: January 2003
|
Junior Member |
|
|
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL END DECLARE SECTION;
void main()
{
EXEC SQL WHENEVER SQL ERROR GOTO error;
EXEC SQL CONNECT :"SCOTT/TIGER@DBNAME";
return;
error:
printf("Error - %s",sqlca.sqlerrm.sqlerrmc);
return;
}
if u want more details about this one contact at my mail id
|
|
|
|
|
|
|
|
|
|
Re: How to connect to oracle using 'C' [message #94177 is a reply to message #94118] |
Fri, 16 April 2004 05:02 |
rishikesh
Messages: 3 Registered: April 2004
|
Junior Member |
|
|
Hi Folks,
You could try using OCI to connect to oracle using C.
OCI - Oracle Call Interface.
Its quite powerful...
Try it out..
For further documentation check the Oracle Website.,..
Hope this helps...
Cheers,
Rishi
|
|
|
|
|
|
Re: How to connect to oracle using 'C' [message #94327 is a reply to message #94324] |
Wed, 04 August 2004 17:40 |
Jai Vrat Singh
Messages: 205 Registered: September 2002 Location: Singapore
|
Senior Member |
|
|
#include<sqlca.h>
#include<orca.h> /** this one is not necessary **/
int main()
EXEC SQL BEGIN DECLARE SECTION;
/** declare you host variblee here **/
EXEC SQL BEGIN DECLARE SECTION;
/** This is you connect statement **/
EXEC SQL CONNECT :login IDENTIFIED BY :password ;
..
..
..
return 0;
}
You can find more info in Pro*C documentation avalable on oracle technology network.
|
|
|
|
|
|
|
|
Re: How to connect to oracle using 'C' [message #110310 is a reply to message #93807] |
Sat, 05 March 2005 09:40 |
amit_joshi
Messages: 5 Registered: March 2005
|
Junior Member |
|
|
Hi all
1. Install Pro*C client from the client installation CD.
2. Check the pre-compiler exists and is present in the path
by typing proc at the prompt
#>proc
3.Go to
$ORACLE_HOME/precomp/demo/proc/
directory and check that the samples are installed.
4.Build the sample executable like
make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=sample1 OBJS=sample1.o
5.Check whether sample1 runs fine.
6.Refer to Pro*C Precompilers Guide found in the Oracle documentation for additional details.
Best Regards
Amit Joshi
|
|
|