百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
O

ocilib

> 数据库
开源

OCILIB (用于 Oracle 的 C 和 C++ 驱动程序) - 开源 用于访问 Oracle 数据库的 C 和 C++ 库

335 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

OCILIB (用于 Oracle 的 C 和 C++ 驱动程序) - 开源 用于访问 Oracle 数据库的 C 和 C++ 库

OCILIB - C and C++ Drivers for Oracle

1. About

OCILIB is an open source, cross-platform Oracle driver for C and C++. It provides fast and reliable access to Oracle databases through a simple, consistent API.

The OCILIB library :

  • Offers a rich, full-featured, and easy-to-use API
  • Runs on all major Oracle client platforms
  • Encapsulates OCI (Oracle Call Interface)
  • Provides a C API written in ISO C99 with native Unicode support
  • Provides a C++ API written in standard C++03 (optionally using selected C++11 features when supported)

OCILIB is developed by Vincent Rogier. Get the latest package, install and enjoy it!

2. License

The source code is free source code licensed under Apache License, Version 2.0 - see LICENSE file

3. Features

  • ISO C API
  • ISO C++ API
  • Full ANSI and Unicode support on all platforms (ISO C wide strings or UTF-8 strings)
  • Full 32/64-bit compatibility
  • Compatible with all Oracle versions >= 8.0
  • Automatic adaptation to the runtime Oracle client version
  • Runtime loading of Oracle libraries
  • Built-in error handling (global and thread context)
  • Full support for SQL API and Object API
  • Full support for Oracle SQL and PL/SQL data types (scalars, objects, refs, collections, ...)
  • Full support for PL/SQL (blocks, cursors, index-by tables, and nested tables)
  • Support for non-scalar data types through library objects
  • Oracle Pooling (connections and sessions pools)
  • Oracle XA connectivity (X/Open Distributed Transaction Processing XA interface)
  • Oracle AQ (Advanced Queuing)
  • Oracle TAF (Transparent Application Failover) and HA (High availability) support
  • Binding array interface
  • Returning DML feature
  • Scrollable statements
  • Statement cache
  • Direct Path loading
  • Remote Instances Startup/Shutdown
  • Oracle Database Change Notification / Continuous Query Notification
  • Oracle warnings support
  • Global and local transactions
  • Describe database schema objects
  • Hash tables API
  • Portable threads and mutexes API
  • Partial support for XMLTYPE (fetching only as string content)

5. Installation

You can either use OCILIB release packages or reference OCILIB packages from your favourite package manager (conan, xmake, vcpkg, nuget, ..).

Windows platforms

  • unzip the archive
  • copy ocilib\include\ocilib.h to any place located in your include’s path
  • copy ocilib\lib32|64\ocilib[x].lib to any place located in your libraries path
  • copy ocilib\lib32|64\ocilib[x].dll to any place located in your windows path

GNU (Unix / Linux) platforms

  • untar the archive
  • $ cd ocilib-x.y.z
  • $ ./configure
  • $ make
  • $ make install (you might need to su to make install)

Make sure Oracle and OCILIB libraries paths are defined in your shared library environment variable You need to provide extra configure parameters when using Instant Clients – see Installation section)

6. Examples

Example of a minimal OCILIB C application

c
#include "ocilib.h"
 
int main(int argc, char *argv[])
{
    OCI_Connection* cn;
    OCI_Statement* st;
    OCI_Resultset* rs;
 
    OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT);
 
    cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
    st = OCI_StatementCreate(cn);
 
    OCI_ExecuteStmt(st, "select intcol, strcol from table");
 
    rs = OCI_GetResultset(st);
 
    while (OCI_FetchNext(rs))
    {
        printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs,2));
    }
 
    OCI_Cleanup();
 
    return EXIT_SUCCESS;
}

Example of a minimal OCILIB C++ application

cpp
#include "ocilib.hpp"
 
using namespace ocilib;
 
int main(void)
{
    try
    {
        Environment::Initialize();
 
        Connection con("db", "usr", "pwd");
 
        Statement st(con);
        st.Execute("select intcol, strcol from table");
 
        Resultset rs = st.GetResultset();
        while (rs.Next())
        {
            std::cout (2) << std::endl;
        }
    }
    catch(std::exception &ex)
    {
         std::cout << ex.what() << std::endl;
    }
 
    Environment::Cleanup();
 
    return EXIT_SUCCESS;
}

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Capidriverociocilib

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库