OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog ServiceOceanBase DataPilot

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog ServiceOceanBase DataPilot
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

Embedded SQL in C for OceanBase

V1.1.7Enterprise Edition
  • What's New
  • What is ECOB?
  • ECOB compatibility with Pro*C
  • Install ECOB
  • Data types and variables
    • Overview
    • Supported data types
    • Data type conversion
    • Indicator variable
    • VARCHAR variable
    • Structure
    • String pointer
  • Embedded SQL statements
    • Overview
    • Variable declaration
    • Connect to OceanBase databases
    • Basic SQL statements
    • Prepared statements
    • Stored procedures
    • Cursor
    • Simple dynamic SQL statement
    • ANSI dynamic SQL statements
    • Error handling
      • SQLCA structure
      • WHENEVER statement
    • LOB-related SQL statements
  • Use ECOB
    • Environment preparation
    • Use ECOB
    • Compile the Tuxedo service
  • Command Line Options

Download PDF

Document Feedback
  1. Documentation Center
  2. Embedded SQL in C for OceanBase
  3. V1.1.7

What is ECOB?

Last Updated:2026-09-04 08:37:38

Features
Architecture

OceanBase Embedded SQL in C (ECOB) is an OceanBase precompiler that provides features that are compatible with Oracle Pro*C.

Pro*C is an application development tool provided by the Oracle database ecosystem. When you develop an application in C language, ECOB allows you to embed SQL statements into the source code of the application. These embedded SQL statements can use variables in the C code of the application as input and output parameters. Then, the Oracle PROC precompiler preprocesses the source code for complete syntax analysis and translates the embedded SQL statements and commands into calls to the SQLLIB 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. To provide support for Pro*C, OceanBase develops ECOB that contains the ecob precompiler and the ecoblib runtime library.

A PROC program comprises a great number of PC files and is built by using methods such as makefiles. To minimize your migration costs, the ecob precompiler provides command-line tool options and features that are the same as those of the PROC program.

Features

ECOB of the current version provides the following features:

  1. Supports SQL syntax that is compatible with the OceanBase Oracle mode.

  2. Supports basic embedded SQL statements, such as COMMIT, CONNECT, DELETE, EXECUTE, EXECUTE IMMEDIATE, INSERT, SELECT, UPDATE, WHENEVER, CALL, PREPARE, and ROLLBACK.

  3. Supports cursor-related statements, such as DECLARE, OPEN, CLOSE, and FETCH (including NEXT, ABSOLUTE, WITH HOLD, and CURRENT OF).

  4. Supports descriptors required by ANSI dynamic SQL and descriptor-related statements, such as ALLOCATE, DEALLOCATE, GET, SET, DESCRIBE, and FETCH.

  5. Allows you to use host variables without declaration in BEGIN DECLARE SECTION and END DECLARE SECTION.

  6. Recognizes and processes C preprocessor macros, including #ifdef, #ifndef, #else, #endif, and #define.

  7. The ecoblib library supports the runtime behavior of all the preceding statements. The ecoblib library provides options (such as CHAR_MAP) that are compatible with PROC programs and allows programs to run in the Tuxedo environment.

  8. An ecob program recognizes all options and compatible semantics of PROC programs and can be used as a replacement for PROC programs.

Architecture

ECOB comprises the ecob precompiler and the ecoblib library (libecob.so), a runtime dynamic link library. The following figure shows the architecture of ECOB.

Architecture of ECOB

Previous topic

What's New
Last

Next topic

ECOB compatibility with Pro*C
Next
on this page
Features
Architecture