Connection to Oracle Database

#1

Hello,

This is my first topic on Discourse & Metabase, hope I am doing this right.

I am trying to add an oracle database to metabase.

So far I am doing the following:

  1. Create docker while setting envoirment variable: docker run -d -p 3000:3000 --name metabase -e MB_PLUGINS_DIR=/app/plugins metabase/metabase
  2. Check if envoirment table was set correctly: docker exec metabase env -> Succes
  3. Create plugins folder: docker exec -it metabase mkdir /app/plugins
  4. Copy Jar file from Oracle: docker cp ojdbc8.jar metabase:/app/plugins/ojdbc8.jar
  5. Give full rights to jar file: docker exec -it metabase chmod 777 /app/plugins/ojdbc8.jar
  6. Check if all is correct: docker exec -it metabase ls -lR /app

All seems to be fine, yet still no menu option to add the database type: Oracle. I am pulling the most recent version of Docker.

Any idea what I am missing? Thanks in advance.

1 Like
#2

Hi @GorkyV

Which version of Metabase?

If you’re using the Docker image, then it would probably be smarter to link the plugins directory to a volume outside the image - otherwise it would be destroyed when you upgrade.

Are you using ojdbc8.jar version 12.2.0.1? For reference:
https://metabase.com/docs/latest/administration-guide/databases/oracle.html

Check the Metabase log, when it’s starting up, since it will log which drivers are loaded.

#3

Hello @flamber

I am using: v0.32.8 - Built on 2019-05-13

So silly I did not check the logs before, I am getting:

May 31 20:32:41 WARN metabase.plugins :: Metabase cannot use the plugins directory /app/plugins
Please make sure the directory exists and that Metabase has permission to write to it. You can change the directory Metabase uses for modules by setting the environment variable MB_PLUGINS_DIR. Falling back to a temporary directory for now.
java.lang.AssertionError: Assert failed: Metabase does not have permissions to write to plugins directory /app/plugins
(Files/isWritable <>)

However this is how my permissions look:
1

What could be wrong, folder permissions?

#4

@GorkyV
As you can see, plugins directory is drwxr-xr-x, so you’re probably missing global write rights.
Again, you’re setting yourself up for failure, when the image is upgraded, then anything inside the container will be trashed.
And make sure you don’t use the default H2 in production - or if you do, that should also be stored outside the container.
References:
https://www.metabase.com/docs/latest/operations-guide/start.html#migrating-from-using-the-h2-database-to-mysql-or-postgres
https://metabase.com/docs/latest/operations-guide/running-metabase-on-docker.html

1 Like
#5

Hello @flamber,

Completly overlooked the folder permissions. Thanks for pointing that out and giving me the references. The connection worked!

I am completly new to Docker & Metabase so I was just trying some basic stuff. Do you have any other references for me that I need to take in mind, I will be sure to read and try to execute the two you send me.

#6

@GorkyV
Well, the thing that most people tend to misunderstand with containers is; networking.
You have to think of each container as it’s own server. The container can then be “linked” with storage/networks outside the container (like bridging to between containers).
If you’re new to Docker, then you should probably read their documentation: https://docs.docker.com/

The most important thing with Metabase is just make sure you’re not running the H2 database inside the container - preferably not using H2 at all.
Then you won’t lose data, when you upgrade.
A lot of other things (how to use Metabase etc) are covered in the documentation: https://metabase.com/docs/latest/

#7

Thanks alot @flamber! Hopefully with some practice I get better at both docker and metabase! Have a great weekend!