running metabase on docker and connecting it to oracle database

Metabase is an open source business intelligence tool. It lets you ask questions about your data, and displays answers in formats that make sense, whether that’s a bar graph or a detailed table.

Your questions can be saved for later, making it easy to come back to them, or you can group questions into great looking dashboards. Metabase also makes it easy to share questions and dashboards with the rest of your team.

I wanted to do a test drive of this software to evaluate if it met the requirements for one of our departments. The easiest way to do this, I thought, would be to run a docker container since I already have it installed.

docker run -d -p 3000:3000 –name metabase metabase/metabase

when I headed up to localhost:3000 the setup wizard was launched and it prompt me data to create first user. The next step (optional) was to create a data source. And this is where I couldn’t find Oracle as the database type in the selection control. This is due to licensing restrictions as specified in Working with Oracle in Metabase

Starting in v0.20.0, Metabase provides a driver for connecting to Oracle databases. Under the hood, Metabase uses Oracle’s JDBC driver; due to licensing restrictions, we can’t include it as part of Metabase. Luckily, downloading it yourself and making it available to Metabase is straightforward and only takes a few minutes.

So you must copy the driver and restart the process, but this again presents a problem with the docker container since killing the metabase process would kill the container. So, we have to create our own Dockerfile which copies the oracle driver and configure the plugins folder before metabase starts.

create a folder ‘metabase-oracle’ and copy the ojdbc8.jar inside. Then create a file named ‘Dockerfile’ and copy the following contents

FROM metabase/metabase

COPY ojdbc8.jar /app/plugins/ojdbc8.jar

RUN chmod -R 777 /app/plugins

ENV MB_PLUGINS_DIR=/app/plugins

then build the image

docker build -t metabase-oracle .

now you can run it and test an oracle connection

docker run -d -p 3000:3000 –name metabase metabase-oracle

Screenshot from 2019-05-10 10-30-54

sources:
https://discourse.metabase.com/t/oracle-doesnt-show-up-on-my-database-menu/1525/8