OCILIB (C and C++ Drivers for Oracle) - Open source C and C++ library for accessing Oracle databases
OCILIB (C and C++ Drivers for Oracle) - Open source C and C++ library for accessing Oracle databases
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 :
OCILIB is developed by Vincent Rogier. Get the latest package, install and enjoy it!
The source code is free source code licensed under Apache License, Version 2.0 - see LICENSE file
You can either use OCILIB release packages or reference OCILIB packages from your favourite package manager (conan, xmake, vcpkg, nuget, ..).
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)
Example of a minimal OCILIB C application
#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
#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;
}No open issues yet, or sync has not completed.