(* OCI*ML 0.3 *) A simple Oracle API for OCaml. See blog for latest: http://gaiustech.wordpress.com Please read the file LICENSE and ensure that you are happy with it before continuing. Developed on OCaml 3.12 and Oracle 11g on Debian Wheezy with GCC 4. Requires an Oracle client installation to build and at least instantclient to operate. Pure C so no issues with incompatible C++ libraries. Binaries built with this library have also been run on RHEL 5 with no issues, and compiled with OCaml 4 beta. Instructions: First setup the test schema by running tests/ociml_test.sql as a DBA, then $ make clean && make test && make shell Sample code is provided in the form of the tests in tests/ociml_test.ml. Quite a lot of time in the tests is generating large random datasets. The target "dev" enables all debugging and annotations. As root: # make install To use interactively: $ alias o='if [ -f ./ocimlsh ]; then rlwrap ./ocimlsh; else rlwrap ocaml; fi' $ o Objective Caml version 3.12.1 OCI*ML 0.3 built against OCI 11.2 not connected > let lda = oralogon "gaius/abc123";; val lda : Ociml.meta_handle = {connection_id = 1; commits = 0; rollbacks = 0; lda_op_time = 1.00399088859558105; lda = <abstr>} Also try the included .ocamlinit, which sets up ocimlsh conveniently. It is assumed that you are basically familiar with Oracle and are looking for a way to get "real work" done in OCaml as an alternative to say Perl. Currently supported operations: - connection and disconnection - transaction control (commit and rollback) - multiple open connections, and cursors per connection - AQ enqueue and blocking/timed dequeue - prepared statements (incl. RETURNING clause) - prefetch on SELECTs - bulk/array DML - Ref cursors The library is structured as a thin wrapper around the OCI[1] library in C, on top of which is a higher level library patterned after OraTcl[2], as much as possible the commands do the same things, but usually with fewer options. The OCaml debug log can be enabled in the application, but C debugging requires #define'ing DEBUG and rebuilding. Debug messages from C are tagged {C}. It is intended that a user of OCI*ML should never need to worry about the C layer. Debug messages go to STDERR so that can be redirected e.g. $ ./myapp 2>log An error loading shared libraries is probably either because LD_LIBRARY_PATH doesn't contain $ORACLE_HOME/lib OR you are running code compiled against 11g on a 10g system (vice versa should work). A fatal error on startup is probably because ORACLE_HOME isn't set (correctly). TODO (in no particular order): - LOBs - DCN Inspired by Oracaml[3] Questions, comments, suggestions etc please use the Wiki or Issues features on GitHub. [1] http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/toc.htm [2] http://oratcl.sourceforge.net/manpage.html [3] http://oracaml.sourceforge.net/ (* EOF *)