About Gcc Error

Asked by prasad.ram on 2012-03-28

Sir I write a program i.e for connecting oracle 10g database.
The program is

#include<stdio.h>
#include<stdlib.h>
#include"/home/prasad/oracle/product/10.2.0/db_1/precomp/public/sqlca.h"
int var1;
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR ENAME[10];
int dno;
EXEC SQL END DECLARE SECTION;
main()
{
 EXEC SQL CONNECT SCOTT IDENTIFIED BY TIGER;
 printf("\nConnected to ORACLE as user: \n");

}

it gives errors like

emp1.c:5:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SQL’
emp1.c:6:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ENAME’
emp1.c:8:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SQL’
emp1.c: In function ‘main’:
emp1.c:11:2: error: ‘EXEC’ undeclared (first use in this function)
emp1.c:11:2: note: each undeclared identifier is reported only once for each function it appears in
emp1.c:11:7: error: expected ‘;’ before ‘SQL’

First of all i did not recognize the EXEC keyword
so please help me

For connecting the database through c i searched internet a lot but in that found lot of programs but i didn't find what are
the necessary requirements for connecting the database
So could you please tell me how to connect the database by using c language or at least help me with necessary information

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
Jeet
Solved:
2012-03-31
Last query:
2012-03-31
Last reply:
2012-03-30
Jeet (gour-jitendrasingh) said : #1

did you write program or just copy and paste from somewhere ?

prasad.ram (prasad-ram126) said : #2

On 3/29/12, Jeet <email address hidden> wrote:
> Your question #191906 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
>
> Status: Open => Needs information
>
> Jeet requested more information:
> did you write program or just copy and paste from somewhere ?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
>
> You received this question notification because you asked the question.
>
no sir i am not copeied any where
I am trying to learn the connectivity through c
so i get lot of inforamtion in the net based on that information i
write it if see i just write for connectivity only if it correct then
remaining thing i can handle
so please help me up to the connectivity

Jeet (gour-jitendrasingh) said : #3

Ok go through this link and let me know ... and this question is related to your C programing skill and purely not related to Ubuntu so i suggest you ask on C forum ..
and if any other help regarding Ubuntu please let us know

thanks

prasad.ram (prasad-ram126) said : #5

thanks for providing this help and if you know any c related database
connectivity web sites please send me

On Thu, Mar 29, 2012 at 1:21 PM, Jeet
<email address hidden>wrote:

> Your question #191906 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
>
> Status: Open => Answered
>
> Jeet proposed the following answer:
> Ok go through this link and let me know ... and this question is related
> to your C programing skill and purely not related to Ubuntu so i suggest
> you ask on C forum ..
> and if any other help regarding Ubuntu please let us know
>
> thanks
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906/+confirm?answer_id=2
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
>
> You received this question notification because you asked the question.
>

Jeet (gour-jitendrasingh) said : #6

Sure if i know. i will send you mail you can close this question by marking
solved

Jeet

On Fri, Mar 30, 2012 at 1:00 PM, prasad.ram <
<email address hidden>> wrote:

> Question #191906 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
>
> Status: Answered => Open
>
> prasad.ram is still having a problem:
> thanks for providing this help and if you know any c related database
> connectivity web sites please send me
>
> On Thu, Mar 29, 2012 at 1:21 PM, Jeet
> <email address hidden>wrote:
>
> > Your question #191906 on gcc-defaults in Ubuntu changed:
> >
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
> >
> > Status: Open => Answered
> >
> > Jeet proposed the following answer:
> > Ok go through this link and let me know ... and this question is related
> > to your C programing skill and purely not related to Ubuntu so i suggest
> > you ask on C forum ..
> > and if any other help regarding Ubuntu please let us know
> >
> > thanks
> >
> > --
> > If this answers your question, please go to the following page to let us
> > know that it is solved:
> >
> >
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906/+confirm?answer_id=2
> >
> > If you still need help, you can reply to this email or go to the
> > following page to enter your feedback:
> >
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/191906
> >
> > You received this question notification because you asked the question.
> >
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Best Jeet (gour-jitendrasingh) said : #7

http://www.easysoft.com/developer/languages/c/odbc_tutorial.html

Hope it is helpful

Please mark solved if you feel it is your answer

Thanks

prasad.ram (prasad-ram126) said : #8

Thank you for helping me