2

When trying to open a connection to DuckDb on an EC2 instance:

NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

I am getting the following error:

Caused by: java.lang.UnsatisfiedLinkError: 'java.nio.ByteBuffer org.duckdb.DuckDBNative.duckdb_jdbc_startup(byte[], boolean)'
        at org.duckdb.DuckDBNative.duckdb_jdbc_startup(Native Method)
        at org.duckdb.DuckDBDatabase.<init>(DuckDBDatabase.java:22)

The code opening connection is as follows:

try {
    DuckDBDatabase duckDb = new DuckDBDatabase("jdbc:duckdb:", false);
    connection= new DuckDBConnection(duckDb);
} catch (SQLException e) {
    throw new RuntimeException("Unable to open DuckDB connection.", e);
}

DuckDb is added as a dependency in gradle:

implementation 'org.duckdb:duckdb_jdbc:0.2.4'

The same code works locally on Windows and Linux. Any ideas?

paulsm4
  • 114,292
  • 17
  • 138
  • 190
Mathilda B
  • 31
  • 3

1 Answers1

1

The issue was with architecture. After digging into DuckDb code it turned out that it only accepts x86_64 and amd64. Our instance was aarch64, therefore the .so files were never loaded.

Mathilda B
  • 31
  • 3
  • So the the problem was incorrect architecture (ARM), correct? Thank you for giving the resolution. Please be sure to "accept"! FYI, only "A1" is ARM. I suspect that other, different EC2 instance types (M4, T2, etc.) should be OK: https://aws.amazon.com/ec2/instance-types/ – paulsm4 Jun 11 '21 at 17:54