nimodpi

oracle odpi-c wrapper for Nim

Wrapper score 15/100 · tests present · no docs generated

Wraps a native library — check OS Compatibility below for platform-specific linking notes.

Summary

Latest Version Unknown
License MIT
CI Status Passing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install nimodpi
choosenim install nimodpi
git clone https://github.com/mikra01/nimodpi

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
nimodpi - - - - - - -

Source

Repository https://github.com/mikra01/nimodpi
Homepage https://github.com/mikra01/nimodpi
Registry Source nimble_official

README

nimodpi

Oracle ODPI-C wrapper for Nim

Oracle ODPI-C Documentation

dependencies

  • Oracle Instant Client (see ODPI-C Documentation for details)
  • nimterop

announcement

unfortunately nimterop does not compile with the latest nim release (2.x). Nimterop seems stale; due to that we decided to switch to futhark. The actual quickfix present is stay at nim version 1.6.

how to install

clone this project directly or use "nimble install nimodpi". then import the module "db_oracle" within your project. the dependent ODPI-C source is directly included into your project (via nimterop)

See the "isMainModule" section at the end of the module for some examples.

Besides the abstraction layer you can also consume the raw ODPI-C API if something is missing ( or PR me your solution ).

See /demo/demo.nim for some direct ODPI-C examples. The subdir /demo also contains an example how sqlplus could be utilised for script execution.

Remarks

upgraded to Nim Compiler Version devel (should also work with latest release), ODPI-C 4.3.0 and nimterop 0.6.11. The ODPI-C version is hardcoded within the static section of nimodpi.nim (nimterop control file) - don't forget to flush nimcache when changing the version between compile runs. The NIM-API could be subject of change.

Oracle XE installation

For testing just install a local copy of the oracle xe: https://www.oracle.com/database/technologies/appdev/xe.html

The oracle instant client is already included.

Tests only against windows 10 OS - if you face problems while installing xe onto your machine: the installer logs everything under the program files directory within the subdirectory /Oracle/Inventory/logs. Before installing make sure a third party virus scanner is disabled. (I faced no problems with the windows defender).

My database was created with the nls_character set "AL32UTF8"

To check your database characterset you could query for:

select DECODE(parameter, 'NLS_CHARACTERSET', 'CHARACTER SET',
'NLS_LANGUAGE', 'LANGUAGE',
'NLS_TERRITORY', 'TERRITORY') name,
value from v$nls_parameters
WHERE parameter IN ( 'NLS_CHARACTERSET', 'NLS_LANGUAGE', 'NLS_TERRITORY')
/

If you like to browse the schemas use Oracle SQL Developer for instance. Future examples will be based on the HR schema. This user is locked by default so the examples will only work if you use sysdba for the connecting user.

demo

before running the demo, adjust "/demo/democredentials.nim" (login and connection_string) for the database you like to connect to. No ddl is executed.

run the raw ODPI-C demo with "nimble demo".

run the nim demo with "nimble db_oracle". this demo executes some DDL and performs a cleanup.

Todo

direct bindings almost completed except SODA/BLOB/VARRAY; the nimish abstraction layer (db_oracle) is functional but more examples needed. next steps would be provide documented examples.

Comments, bug reports and PR´s appreciated.