View Single Post

   
  #2 (permalink)  
Old 02-27-2008, 11:50 AM
Ian
 
Posts: n/a
Default Re: Error compiling DB2 C++ application.

dotyet wrote:
> Hi Everyone,
>
> I am learning how to write C++ programs for DB2. My primary area of
> concern would be the administrative level DB2 APIs.
>
> For the time being, I am also looking at how to create packages and
> bindfiles for DB2. I have the below mentioned code which is giving me
> the following error:


When you write programs with embedded SQL, you have to run them through
the DB2 Precompiler, first. By convention, your source file would be
named 'test.sqC'. You'd then use the 'PREP' command:

db2 prep test.sqC bindfile

This produces the files 'test.C' and 'test.bnd'. You'd then use the
compiler to compile/link the test.C file, and the BIND command to add
the package to the database.

A word to the wise: Do *not* change the generated .C file after
executing the PREP command: The generated .C file is tied closely
to the corresponding .bnd file, and you'll create issues for yourself.
(Typically timestamp mismatch issues).



Good luck,
Reply With Quote