Skip to content
Bikram Chatterjee edited this page Jan 2, 2016 · 2 revisions

ErlOCI - A low level Oracle driver for Erlang

Getting started

Read the README for compilation instructions

Create a driver instance

application:start(erloci).
OciPort = erloci:new([{logging, true},
 {env, [{"NLS_LANG", "GERMAN_SWITZERLAND.AL32UTF8"}]}]).

note the use of optional environment variable(s) NLS_LANG which effects OCI directly (transparent to erloci)

executing a simple select query

OciSession = OciPort:get_session(Tns, User, Pswd).
SelStmt = OciSession:prep_sql("select * from dual").
{cols,[{<<"DUMMY">>,'SQLT_CHR',_,0,0}]} = SelStmt:exec_stmt()).
{{rows,[ [<<"X">>] ]},true} = SelStmt:fetch_rows(100)).

Cleanup a driver instance

OciPort:close().
application:stop(erloci).

API Reference

-- TODO -- (link to edoc)

EUnit Tests

EUnit tests are the latest documentation of what is currently supported by the driver. The following test cases also serves the purpose of documenting API usage guide:

API usage examples

  • drop_create
  • bad_sql_connection_reuse
  • insert_select_update
  • auto_rollback_test
  • commit_rollback_test
  • asc_desc_test
  • lob_test
  • describe_test
  • function_test
  • procedure_scalar_test
  • procedure_cur_test
  • timestamp_interval_datatypes