Ocilib
Encyclopedia
OCILIB is an open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 and cross platform
Cross-platform
In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

 Oracle
Oracle Corporation
Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...

 C library that delivers fast and reliable access to Oracle databases
Oracle Database
The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....

.

The OCILIB library :
  • offers a rich, full featured and easy to use C API
  • runs on all Oracle platforms
  • is written in pure ISO C code with native ISO C Unicode
    Unicode
    Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

     support
  • encapsulates OCI
    Oracle Call Interface
    In computing, the Oracle Call Interface consists of a set of C-language software APIs which provide an interface to the Oracle database....

     (Oracle Call Interface)
  • is the most complete available OCI wrapper
    Wrapper library
    In computer programming, a library is a collection of subroutines or classes used to develop software. Libraries expose interfaces which clients of the library use to execute library routines. Wrapper libraries consist of a thin layer of code which translates a library's existing interface into a...



OCILIB is used in applications written in various languages such as C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

, C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

, Objective-C
Objective-C
Objective-C is a reflective, object-oriented programming language that adds Smalltalk-style messaging to the C programming language.Today, it is used primarily on Apple's Mac OS X and iOS: two environments derived from the OpenStep standard, though not compliant with it...

, Erlang, Lisp, PureBasic
PureBasic
PureBasic is a commercially distributed procedural computer programming language and integrated development environment based on BASIC and developed by Fantaisie Software for Windows 32/64-bit, Linux 32/64-bit, and Mac OS X. An Amiga version is available, although it has been discontinued and...

, Blitz BASIC
Blitz BASIC
Blitz BASIC refers to the programming language dialect that was interpreted by the first Blitz compilers, devised by New Zealand-based developer Mark Sibly. Being derived from BASIC, Blitz syntax was designed to be easy to pick-up for beginners first learning to program...

, and others.

Compatibilities

OCILIB runs on any 32 bits and 64 bits platform having an ISO C compliant compiler and supported by Oracle.




Here is the lists of validated configurations.

Platforms

  • Windows
    Microsoft Windows
    Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

  • Unix
    Unix
    Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

     (AIX, HP-UX
    HP-UX
    HP-UX is Hewlett-Packard's proprietary implementation of the Unix operating system, based on UNIX System V and first released in 1984...

    , Linux
    Linux
    Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

    )
  • Mac OS X
    Mac OS X
    Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

  • Solaris
  • OpenVMS
    OpenVMS
    OpenVMS , previously known as VAX-11/VMS, VAX/VMS or VMS, is a computer server operating system that runs on VAX, Alpha and Itanium-based families of computers. Contrary to what its name suggests, OpenVMS is not open source software; however, the source listings are available for purchase...

     (pending)

Compilers

  • Microsoft C/C++ compilers
  • GCC
    GNU Compiler Collection
    The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

    , MinGW
    MinGW
    MinGW , formerly mingw32, is a native software port of the GNU Compiler Collection and GNU Binutils for use in the development of native Microsoft Windows applications; MinGW can function either as a cross compiler targeting Windows or as a native toolchain run on Windows itself...

  • IBM XL C
  • Intel compilers
  • LabView
    LabVIEW
    LabVIEW is a system design platform and development environment for a visual programming language from National Instruments. LabVIEW provides engineers and scientists with the tools needed to create and deploy measurement and control systems.The graphical language is named "G"...

  • Various CCs

Library

  • Pure ISO code (ANSI / Wide string)
  • Easy API (JDBC's like)
  • Cross platform
  • Compatible with all Oracle versions >= 8i
  • Full Unicode support (UTF8 and UTF16)
  • Supports static / shared oracle linkage
  • Supports runtime loading of Oracle shared libraries
  • Error handling (global and thread contextual)
  • Small memory usage

Datatypes

OCILIB supports all Oracle SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 and PL/SQL
PL/SQL
PL/SQL is Oracle Corporation's procedural extension language for SQL and the Oracle relational database...

 datatypes :
  • Scalar types : CHAR, VARCHAR, VARCHAR2, NUMBER, FLOAT, ...
  • binary types : RAW, LONG RAW, VARRAW, ..
  • Larges Objects : BLOB, CLOB, NCLOB, BFILE, CFILE
  • LONG types: LONG, VAR LONG, ...
  • Date, Timestamps and Intervals : DATE, TIMESTAMP, INTERVAL
  • PL/SQL types : Ref cursors, PL/SQL Tables
  • Objects (Named Types) and Objects references (REFs)
  • SQL Collections : VARRAYs and Nested Tables
  • ROWIDs and UROWIDs

Features

  • Easy and complete API providing more than 600 functions
  • Full support for OCI relational API
  • Full support for OCI object API
  • Host variable binding
  • Array interface binding and batch errors handling
  • Oracle connection and session pools
  • Scrollable cursors
  • Direct Path loading
  • Oracle Advanded Queues(Oracle AQ)
  • Oracle XA connectivity (X/Open Distributed Transaction Processing XA interface
    X/Open XA
    In computing, the XA standard is a specification by The Open Group for distributed transaction processing . It describes the interface between the global transaction manager and the local resource manager...

    )
  • Oracle TAF (Transparent Application Failover) and HA (High availabality) support)
  • Oracle SQL "Returning into" DML feature
  • Binding array Interface
  • Scrollable statements
  • Statement cache
  • Startup/shutdown remote Oracle instances
  • Oracle Database Change notification / Continuous Query Notification
  • Oracle warnings support
  • Global transactions
    Database transaction
    A transaction comprises a unit of work performed within a database management system against a database, and treated in a coherent and reliable way independent of other transactions...

  • Provides Hash tables
    Hash table
    In computer science, a hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys , to their associated values . Thus, a hash table implements an associative array...

     support
  • Provides portable threads
    Thread (computer science)
    In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...

     and mutexes API
  • Describe database objects

Documentation


Tutorials


Example

Example of a complete minimal OCILIB application :

  1. 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;
}

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK