Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to set up an environment for learning: writing and testing simple C programs to perform DB2 database operations on an Ubuntu 18.04. system.

I installed DB2 with help of web tutorials and IBM pages, received database info from the installer, wrote simple programs in Gedit..

I compiled the simplest programs with Gnu C Compiler (gcc).

As soon as the compiler ran into the "EXEC SQL..." line it terminated and reported an error.

What's my next step in making this thing work?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
321 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can also learn from the IBM provided example embedded-SQL programs that are supplied (by default) with the Db2 on Linux.

These are in the samples subdirectory of the instance owner home directory (for example /home/db2inst1/samples/c.

In the samples directory there are subdirectories for many other programming languages to show how to use them with Db2.

The files containing embedded SQL for C programs have extension .sqc.

There is a long README, and some scripts that show you how to compile and build these programs, showing how to use the SQL preprocessor etc.

You can also see the samples online in the free Knowledge Center for Db2 , for example for V11.1 the URL to the C samples (and SQC samples) is here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...