DB2 Precompile



IBM's flagship relational database management system

DB2 Precompile

Postby suruchi » Fri Jun 18, 2010 11:36 pm

What I have understood about DB2 precompiler is that it reads the source code and comments the SQL statement and replaces them with call to DB2. It checks SQL statement for syntax errors. Also Precompiler do not refer to DB2 catalog table.
I have been asked in an interview that how does Precompiler identifies SQL statement if DB2 catalog table is not refered?

Can anyone please explain me that how precompiler identifies SQL statement ?

Thanks
suruchi
 
Posts: 3
Joined: Fri Jun 18, 2010 5:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DB2 Precompile

Postby dick scherrer » Fri Jun 18, 2010 11:42 pm

Hello and welcome to the forum,

Can anyone please explain me that how precompiler identifies SQL statement ?

Maybe:
EXEC SQL
.
thru
.
END-EXEC?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: DB2 Precompile

Postby suruchi » Fri Jun 18, 2010 11:52 pm

Thanks for the reply

I was doing more research on this and I found that precompiler does a basic syntax checking by referring DB2 DECLGEN
I am not sure if this is correct.


Thanks
suruchi
 
Posts: 3
Joined: Fri Jun 18, 2010 5:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DB2 Precompile

Postby dick scherrer » Sat Jun 19, 2010 12:48 am

Hello,

Yes, this is also true. . . DCLGEN info is "include"d in w-s typically.

All of the sql statements are "wrapped" in "exec sql"/"end-exec".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post