Connecting to Amazon Neptune with ODBC

Use OpenLink Virtuoso as an ODBC Bridge to Amazon Neptune

Daniel Heward-Mills
OpenLink Virtuoso Weblog
4 min readMar 9, 2021

--

OpenLink Virtuoso is a multi-model database that both stores and utilizes Graph and Tabular relations using the SQL and SPARQL query languages.

The combination of its ODBC driver, and ability to query remote SPARQL endpoints using SPARQL-FED allow it to operate as an ODBC bridge driver to other Graph DBMS instances hosted by 3rd parties e.g., Amazon Neptune.

This post provides a guide for using Virtuoso as a bridge that connects ODBC-compliant applications to an Amazon Neptune instance, courtesy of SPARQL’s federated query functionality (a/k/a SPARQL-FED).

Prerequisites

  • A Commercial or Open Source Virtuoso Installation on an EC2 machine that is part of the same VPC as your Neptune Instance, or that is accessible using a SOCKS proxy to a machine in the same VPC (Free Trial, Pay-As-You-Go Cloud Edition, Open Source).
  • Virtuoso Client Connectivity kit Installation, which provides the required ODBC Driver for Virtuoso Data Sources. This kit is available as a bundled installation with Commercial and Open Source Edition Virtuoso Installers, and can also be downloaded separately for Windows and macOS .
  • Access to Your Virtuoso Instance SQL Listener port (Default: 1111)

Setup

Confirm that you can access your Amazon Neptune instance from Virtuoso using a Federated SPARQL Query (SPARQL-FED).

For Example:

Creating a Virtuoso ODBC DSN

Once a successful connection has been made to Neptune, the next step is to create an ODBC DSN for accessing your Virtuoso instance.

This example uses the iODBC Administrator 64 application for macOS, and can also be repeated using the Windows ODBC Administrator (64-bit), or making an addition to your ODBC.ini document on Unix operating systems.

  1. Open iODBC Administrator, and click Add. Next, select OpenLink Virtuoso ODBC Driver, or OpenLink Virtuoso ODBC Driver (Unicode), and click the Finish button.

2. Name your DSN, add the location of your Virtuoso instance’s SQL listener, and click Next.

3. To confirm connectivity, enter your Virtuoso username and password, then click Continue

4. If successful, click on the Test tab, and then click Finish.

Test Query

5. Open iODBC Demo 64 (or C++ Demo on Windows), navigate to Environment -> Open Connection, and select your previously created ODBC DSN.

6. Click OK, enter your Virtuoso login credentials, and click OK.

7. Once successfully connected, navigate to SQL -> Execute SQL. Enter your query by adding SPARQL at the beginning, followed by your SPARQL query.

8. Click OK, and results from your Amazon Neptune instance will be returned.

A successfully returned query is the result of a successful ODBC connection to Amazon Neptune, using Virtuoso as the middleware between an ODBC Application (iODBC Demo) and a remote SPARQL endpoint (Amazon Neptune). This can be further repeated in other ODBC-compliant applications such as Excel, Qlik, Tableau, and others.

Related Content

--

--