ScalarDB FDW
ScalarDB FDW is a PostgreSQL extension that implements a foreign data wrapper (FDW) for ScalarDB.
ScalarDB FDW uses the Java Native Interface to directly utilize ScalarDB as a library inside the FDW and read data from external databases via scan operations for ScalarDB.
Prerequisites
You must have the following prerequisites set up in your environment.
JDK
You must install a version of the Java Development Kit (JDK) that is compatible with ScalarDB. In addition, you must set the JAVA_HOME
environment variable, which points to your JDK installation directory.
Note that since these extensions use the Java Native Interface (JNI) internally, you must include the dynamic library of the Java virtual machine (JVM), such as libjvm.so
, in the library search path.
PostgreSQL
This extension supports PostgreSQL 13 or later. For details on how to install PostgreSQL, see the official documentation at Server Administration.
Build and installation
You can build and install this extension by running the following command.
make install
Common build errors
This section describes some common build errors that you might encounter.
ld: library not found for -ljvm
Normally, the build script finds the path for libjvm.so
and properly sets it as a library search path. However, if you encounter the error ld: library not found for -ljvm
, please copy the libjvm.so
file to the default library search path. For example:
ln -s /<PATH_TO_YOUR_LIBJVM_FILE>/libjvm.so /usr/lib64/libjvm.so
Usage
This section provides a usage example and available options for FDW for ScalarDB.
Example
The following example shows you how to install and create the necessary components, and then run a query by using the FDW extension.