Chapter 7.  Building Third Party APIs

Table of Contents

Building the Go API
Install Oracle Berkeley DB
Build Go Berkeley DB (go-bdb)
Test Go Berkeley DB (go-bdb)
Additional Information
Building Node.js
Additional Information

This chapter provides information on building third party APIs. See the sections below:

Building the Go API

To install Go bindings for Oracle Berkeley DB, get a go-bdb package from https://orahub.oraclecorp.com/nosql-bdb-dev/go-bdb. You will need an Oracle SSO account. Download your preferred package format; then install it following the steps mentioned in the sections below.

Install Oracle Berkeley DB

Download Berkeley DB 6.2.32 or higher from http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html

  • Windows

    1. Build Berkeley DB from the source code using Minimalist GNU for Windows (MinGW). The easiest way to get access to MinGW is to download and install MinGW-64 (https://sourceforge.net/projects/mingw-w64/) and MSYS (https://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/)

      For more information on MSYS and MinGW, see http://www.mingw.org/wiki/MSYS

    2. Start a MSYS terminal and change into the unpacked db-6.2.32 directory.

    3. Execute the following command in the db-6.2.32/build_unix directory.

      ../dist/configure --prefix=/c/bdb/install 
      --enable-cxx --enable-mingw --host=x86_64-w64-mingw32
      make
      make install

    4. Set the following environment variables:

      set CPATH=C:\bdb\install\include
      set LIBRARY_PATH=C:\bdb\install\lib
      set PATH=C:\bdb\install\lib;%PATH%

  • Linux/Posix

    1. Unpack the Berkeley DB source library and change to the directory db-6.2.32/build_unix.

    2. Execute the following command:

      ../dist/configure --prefix=/usr/local/bdb/install --enable-cxx
      make
      make install

    3. Set the following environment variables:

      export CPATH=/usr/local/bdb/install/include
      export LIBRARY_PATH=/usr/local/bdb/install/lib
      export LD_LIBRARY_PATH=/usr/local/bdb/install/lib:$LD_LIBRARY_PATH

Build Go Berkeley DB (go-bdb)

  1. Under your Go installation, change to the directory Go/src and add the directory orahub.oraclecorp.com/nosql-bdb-dev.

  2. Change to orahub.oraclecorp.com/nosql-bdb-dev.

  3. Choose either of the following options:

    1. Checkout go-bdb using the command:

      git clone git@orahub.oraclecorp.com:nosql-bdb-dev/go-bdb

    2. Download a .zip or .tar.gz from https://orahub.oraclecorp.com/nosql-bdb-dev/go-bdb and unpack it into the orahub.oraclecorp.com/nosql-bdb-dev directory.

  4. Build go-bdb using the command:

    go build orahub.oraclecorp.com/nosql-bdb-dev/go-bdb

Test Go Berkeley DB (go-bdb)

  1. Change to the examples directory in Go/src/orahub.oraclecorp.com/nosql-bdb-dev/go-bdb/_examples.

  2. Change to the directory HelloWorld.

  3. Enter the command:

    go run HelloWorld.go

    If Hello World! is printed out, then the installation was successful.

Additional Information

  • Go/src/orahub.oraclecorp.com/nosql-bdb-dev/go-bdb/_examples - Examples of how to use Berkeley DB are located in this directory.

  • HelloWorld - Shows the basics of Berkeley DB, how to create a database and put and get data.

  • Replication - Shows how to set up a replication group and replicate data from the master environment to a replica environment.

  • Bulk - Shows how to do bulk inserts and gets.