1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

dockerのmetabaseにoracleのjdbcドライバを追加

Last updated at Posted at 2021-06-10

version v0.39.3

metabase はライセンスの関係でoracleのjdbcドライバをデフォルトでは含めていない。なのでoracleを使いたい場合は自分で追加の必要がある。jarで起動する場合はpluginsディレクトリにjdbcドライバを配置で良い。https://www.metabase.com/docs/latest/administration-guide/databases/oracle.htmlhttps://qiita.com/mkyz08/items/376895d64897181b18e9 を参照。

dockerの場合は https://www.metabase.com/docs/latest/operations-guide/running-metabase-on-docker.html#adding-external-dependencies-or-plugins のように、ホスト側のjdbcドライバをvolumeでマウントすればよい。

たとえば、下記のようなディレクトリを作成して、

docker-compose.yml
plugins
+-ojdbc8.jar

volumesでマウントする。

docker-compose.yml
version: "3.7"

services:
  metabase:
    image: metabase/metabase:latest
    ports:
      - "3000:3000"
    volumes:
      - ./plugins:/plugins

成功すればそれっぽいログが出るし、データベース追加画面でoracleが選択可能になる。

metabase_1  | 2021-06-10 06:24:09,521 INFO plugins.classloader :: Added URL file:/plugins/ojdbc8.jar to classpath

ハマった点

FileSystemException

/plugins ディレクトリは実行時に書き込み権限が必要。以下のエラーログから分かるように、JDBCドライバのファイルをコピーして配置する、みたいな処理を行うため。WSLで実行してると特にこのハマり方しやすいんじゃないかな、という気がする。

metabaseoracle-metabase-1  | 2024-07-02 05:22:02,484 ERROR util.files :: Failed to copy file
metabaseoracle-metabase-1  | java.nio.file.FileSystemException: /plugins/oracle.metabase-driver.jar: Operation not permitted

解決方法としては、以下のようにディレクトリではなく特定ファイルだけをマウントするよう変更する。

      - ./plugins/ojdbc8.jar:/plugins/ojdbc8.jar
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?