Using the RaimaDB JDBC in an Android Application

RaimaDB provides a JDBC (Java Database Connectivity) driver that works with its native (C/C++) libraries. This allows an Android application to access RaimaDB databases natively.

This document explains how to include the RaimaDB JDBC Driver and libraries in an Android application using the Android Studio development environment.

Create a New Project (optional)

If you do not have an existing Android Studio project to add RaimaDB support to, create a new one. The language can be Java or Kotlin since Java methods can be called inside Kotlin. Since the RaimaDB libraries are already precompiled, you do not need to choose the Native C/C++ project type.

Add the RaimaDB JDBC Driver to the Project

Take the following steps to add the RaimaDB JDBC Driver to your Android Studio project.

  1. Locate the RaimaDB JDBC Driver file (rdmjdbc.jar) in the RaimaDB package. It is found in the <install_dir>/share/java folder, where <install_dir> points to the directory RaimaDB is installed.

  2. Copy the file in the app/libs directory of your project. If the directory does not exist, create it.
  3. Right-click rdmjdbc.jar and select the Add As Library... option.
  4. Click OK in the Create Library dialog box.

Add the RaimaDB Native Libraries to the Project

To use the RaimaDB JDBC Driver to access RaimaDB databases natively, you need to add the following RaimaDB libraries to the project.

librdmbase.so
librdmddl.so
librdmenc.so
librdmhttp.so
librdmjdbcjni.so
librdmpsp.so
librdmrdm.so
librdmrsql.so
librdmtfs_full.so
librdmtfs.so
librdmtransport.so
librdmtx.so
librdmxml.so

Take the following steps to add the appropriate RaimaDB libraries to your Android project.

  1. Determine the architecture of your Android application. Note that RaimaDB currently supports the following architectures: x86_64 (emulator), arm64-v8a and armeabi-v7a.
  2. Locate the above libraries in the architecture-specific sub-directory under <install_dir>. See table below:
Android Target Platform RaimaDB Libraries Location
x86_64 <install dir>/android-x86_64/lib
arm64-v8a <install dir>/android-arm64/lib
armeabi-v7a <install dir>/android-armeabi/lib
  1. Copy the libraries to the architecture-specific sub-directory under your project's app/src/main/jniLibs sub-directory. If the directory does not exist, create it.

Now your Android project is ready to use RaimaDB JDBC.