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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…