Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
332 views
in Technique[技术] by (71.8m points)

ubuntu - Setting up Linux-C-DB2 environment

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...