Version française
Home     About     Download     Resources     Contact us    
Browse thread
Oracle OCCI C++ interface
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Serge Aleynikov <serge@h...>
Subject: Oracle OCCI C++ interface
Hi All,

I would like to announce availability of the OCaml client interface
library for Oracle.  In the contrast to existing projects (oci8ml,
eqoci) found elsewhere, this project uses Oracle 10g's OCCI C++
interface on top of OCI.  This allowed to implement a rich set of DML
and DDL operations with the database.  The library requires installation
of an Oracle 10g Instant Client library.  See doc/index.html file for
installation instruction of prerequisites.

The following operations with an Oracle database are supported:

   - Simple DML operations including SELECT / INSERT / UPDATE / DELETE
   - Parameterized DML operations including SELECT / INSERT / UPDATE / 
DELETE
   - Execution of PL/SQL stored procedures
   - Execution of bulk DML array INSERT / DELETE / UPDATE operations
   - Oracle exception handling
   - Oracle bulk exception handling with specifying failed rows and
errors for each row
   - Transaction control (commit and rollback)
   - Automatic garbage control of Oracle resources (connections, statements
     and cursors)
   - Functional and Object-Oriented API included

You'll need to modify the Makefile to include paths to an Oracle home
and OCaml installation.

The OCaml portion of the library is written in the revised syntax.  The
following example illustrates one of the most powerful features of using
array DML insert of records with exception-based control of failed rows
(note that the entire array is sent to an Oracle database in a single
network roundtrip):

try
     let n = statement#execute_array
                 ~sql:"insert into test (id, name, dt, num) values (:1, 
:2, :3, :4)"
                 [
                     [| Var_int 1; Var_str "AAA"; Null_date; Null_float |];
                     [| Var_int 2; Null_str;      Null_date; Null_float |];
                     [| Var_int 3; Null_str;      Null_date; Null_float |]
                 ]
     in
         Printf.printf "Inserted %d records using array DML\n" n
with [ORA_BULK_EXCEPTION (m, a) -> do {
           print_endline m;
           Array.iter (fun (i, e, m) -> Printf.printf "  Row[%d]: %d - 
%s\n" i e m) a
       }
];

The project home page is http://oracaml.sourceforge.net.  It contains 
links to documentation and download site.

Your feedback and enhancement requests are welcome.

Regards,

Serge

-- 
Serge Aleynikov
Routing R&D, IDT Telecom
Tel: +1 (973) 438-3436
Fax: +1 (973) 438-1464