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

Maven – Añadir dependencia al controlador de PostgreSQL

Si tienes un proyecto de Maven en el cual quieres conectarte a una base de datos PostgreSQL, puedes utilizar el controlador JDBC de PostgreSQL agregando la siguiente dependencia a tu archivo pom.xml
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
Fuentes:

Oracle – java.lang.NoClassDefFoundError: oracle.sql.CharacterSet.CharacterConverterBehavior

Estaba trabajando en un reporte de BIRT que utiliza una conexión JDBC a una base de datos de Oracle y me arrojaba la siguiente excepción:

java.lang.NoClassDefFoundError: oracle/sql/CharacterSet$CharacterConverterBehavior

Al parecer, esto se debe a que en la configuración de Drivers de BIRT tenía configurado el driver de la conexión con «oracle.jdbc.driver.OracleDriver», pero este paquete dejó de ser soportado después de la versión 10.2. Es necesario cambiar la configuración a «oracle.jdbc.OracleDriver».

Este problema fue a partir de que actualice el JAR de Oracle, ojdbc6.jar, en BIRT.

Fuentes:
https://forums.oracle.com/forums/thread.jspa?threadID=697209 

Eclipse – BIRT JDBC Oracle Driver

I had a report which connects to an Oracle Database through JDBC to get data. Since I reinstalled eclipse and BIRT, my JDBC configuration was lost. Therefore when I tried to preview my report the following error was thrown:

Table TBL_EXPEDIENTES_ASIGNADOS:
An exception occurred during processing. Please see the following message for details:
Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
    org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot load JDBC Driver class: oracle.jdbc.OracleDriver

The only way I’ve found to manage your JDBC drivers is to open the new datasource dialog and select «JDBC Datasource», put whatever name you like and press next. You should see a button with the label «Manage Drivers…». Then you could add the ojdbc6.jar or whatever JDBC driver you need.

Eclipse BIRT – Cannot load JDBC Driver class

Hace poco reinstale el Eclipse y sus plugins, entre ellos BIRT. Al abrir un reporte existente que tenia conexiones a una base de datos de Oracle me marcaba el siguiente error:

Cannot load JDBC Driver class: oracle.jdbc.OracleDriver

Esto es porque por default, BIRT no trae los controladores de Oracle. Para instalarlos yo pensé que estaría en las Preferencias de Eclipse o mediante algún menú en la Perspectiva «Report Design» pero nunca lo encontré. Fue hasta que intente crear una nueva conexión –JDBC Data Source- que vi un botón que dice «Manage Drivers» … BINGO!
Solo tienes que dar clic en ese botón y te aparecerá una ventana donde puedes agregar el controlador de Oracle -un archivo JAR, ojdbc6.jar por ejemplo-
Una vez agregado ya no me marcó el error. Este controlador lo podrás utilizar cuando quieras crear un nuevo Data Source que se conecte a bases de datos Oracle.