#docslug#/ecob/ecob/V1.1.6/ulmst2
Overview
OceanBase Embedded SQL in C (ECOB) provided by OceanBase is compatible with the Pro*C precompiler of Oracle.
When you develop an application in C language, both ECOB and Pro*C allow you to embed SQL statements in the source code of the application.
Then, the ECOB precompiler preprocesses the source code for complete syntax analysis and translates the embedded SQL statements and commands into calls to the ecoblib runtime library.
After that, ECOB generates a source code file of the application in C language. After the file is compiled and linked by a C compiler, an executable program is generated.
After you install ECOB, you can precompile PC files, and compile and link C files.
Precompile the PC files
If you use the ECOB precompiler to compile PC files to C files, you can separately compile each PC file. In normal cases, you need only to specify the source files to be processed. The following statement shows the commands used to specify the source files to be processed:
ecob example.pc # Generate an example.c file.
cc example.c # Use the C language compiler to compile the file.
The following statement provides an example on how to use the INCLUDE option to specify the path for querying the header file and define a required macro:
ecob INCLUDE=/home/example/include INCLUDE=/usr/local/include DEFINE=MY_MACRO DEFINE=MY_MACRO=VALUE ONAME=main.c INAME=main.pc
Compile and link the C file
After you use the ECOB precompiler to compile a PC file to a C file, you need to use the C language compiler, such as cc, to compile and link the C file. When you link the C file, you need to use the ecoblib runtime library (libecob.so) and the OceanBase Call Interface (OBCI) library. By default, libobci.so is installed in the /u01/obclient/lib path. The following statement is an example.
-lecob -lobci -lobclnt -L/u01/obclient/lib/