DB2 Driver

Hi everyone !

i try to add the AS400 / IBM i DB2 Driver for Metabase

Step 1: I clone the Metabase repository and change the directory to the folder in which i cloned the Metabase Git repository
git clone https://github.com/metabase/metabase.git
cd /path/to/cloned_metabase_repository

Step 2: Run the following command to install prerequisites for building drivers
lein install-for-building-drivers

Step 3: I cloned the HTTP Driver repository
git clone https://github.com/damienchambe/metabase-db2-driver.git

Step 4: I changed the directory to the DB2 driver repository that you just cloned and run the following commands to build the DB2 driver:
lein clean
DEBUG=1 LEIN_SNAPSHOTS_IN_RELEASE=true lein uberjar

But i have this error message :

Leiningen's classpath: :/usr/share/java/leiningen-2.8.1.jar

Applying task uberjar to []
Applying task javac to nil
Running javac with [-target 1.8 -source 1.8 @/tmp/.leiningen-cmdline1894825082081987338.tmp]
Applying task compile to nil
Compiling metabase.driver.db2
Syntax error compiling at (metabase/driver/db2.clj:112:1).
Syntax error compiling at (metabase/driver/db2.clj:112:1).
No such var: driver/date-add

Full report at:
/tmp/clojure-6001965880117386123.edn
Compilation failed: Subprocess failed

thanks for your help in advance

Hi @Zekura
You should try using a specific branch like release-x.38.x instead of master, which is the upcoming major version (currently 0.39.0)
And make sure that the driver is compatible with the branch.

Ok !

I try this
git clone -b v0.38.1 https://github.com/metabase/metabase.git
but i dont find metabase.jar when i try to follow the README of https://github.com/damienchambe/metabase-db2-driver

And for your information

# OS and version
 sed -nE 's/^PRETTY_NAME="([^"]+)"$/\1/p' /etc/os-release
 Ubuntu 18.04.5 LTS
# Git branch and commit
 echo `git status | head -1 && git log -1 --format="commit %H"`
 Actuellement sur aucun branche.
# Java version and architecture
 java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
# Java variable configuration
 echo $JAVA_HOME
 "empty"
# Java path configuration
 echo $PATH | grep --color=never -oe "/usr/lib/jvm/[^:]*"
 "empty"
# Lein version
 lein --version
 Leiningen 2.8.1 on Java 1.8.0_282 OpenJDK 64-Bit Server VM
# NodeJS version
 nodejs --version
 v12.21.0
# Yarn version
 yarn --version
 0.32
# Clojure version
 clojure --help | grep Version
 "empty"

@Zekura You can download source for each tag in the assets: https://github.com/metabase/metabase/releases

Try with JDK 8 - some people have problems with other JDK’s

You leining is a little old - latest release is 2.9.5 - https://leiningen.org/

ok i upgrad my leining

and try this version of JDK

openjdk version “1.8.0_282”
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode

I reuploaded the git version : https://github.com/metabase/metabase/releases/tag/v0.38.1

i lunch this command : lein install-for-building-drivers

copy the plugins directory (contain db2.metabase-driver.jar, jt400.jar & ojdbc8.jar) in metabase directory

try to lunch : lein run

but i have this message

2021-03-11 15:55:16,209 WARN sync-metadata.sync-timezone :: Error syncing database timezone
java.lang.Exception: Error querying database ‘Sample Dataset’ for current time

@Zekura I haven’t seen that error before. Seems like something is not working completely as it should.
But it’s a warning - and it’s related to the H2 Sample Dataset, so you can ignore that and remove that database.

i think i crused, i have a another error

“Failed to load template ‘frontend_client/index.html’. Did you remember to build the Metabase frontend?”

How i should to do to build the frontend ?

@Zekura Have a look here: https://www.metabase.com/docs/latest/developers-guide.html
Are you actually making any changes to the DB2 driver? If not, have you just considered using the release? https://github.com/damienchambe/metabase-db2-driver/releases

yes I download db2-driver-1.0.2.jar and rename it to db2.metabase-driver.jar

@Zekura Then I don’t understand. Why are you then trying to build Metabase and the driver?

I will try to be clear as possible

my config :

  • Ubuntu 18.04.5 LTS
  • openjdk version “1.8.0_282”
    OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
    OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)
  • Leiningen 2.9.5 on Java 1.8.0_282 OpenJDK 64-Bit Server VM
  • nodejs v12.21.0
  • yarn 1.22.4

Step 1: I clone the Metabase repository and change the directory to the folder in which i cloned the Metabase Git repository

Step 2: Run the following command to install prerequisites for building drivers

  • lein install-for-building-drivers

Step 3: I create the plugins folder with db2-driver-1.0.38.jar (from : hhttps://github.com/damienchambe/metabase-db2-driver/releases/tag/1.0.38) & jt400.jar

  • mkdir -p /path/to/metabase/plugins/

Step 4: Start the frontend build process with

  • yarn build-hot

Step 5: Run your backend development server with

  • lein run

Step 6: Add this additional JDBC properties to be able to use date and time when i configure “Add your data”

prompt=false;naming=sql;date format=iso;time format=hms;time separator=colon

but i have this error message when i try to connect to my db2:

2021-03-12 11:42:05,895 DEBUG middleware.log :: POST /api/setup/validate 400 113,6 ms (0 DB calls) 
{:errors {:dbname "Internal driver error. (com.ibm.as400.access.ClientAccessDataStream cannot be cast to com.ibm.as400.access.DBReplyRequestedDS)"}}

And if i try this time with

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)

i have this error

{:errors
 {:dbname
  "Internal driver error. (class com.ibm.as400.access.ClientAccessDataStream cannot be cast to class com.ibm.as400.access.DBReplyRequestedDS (com.ibm.as400.access.ClientAccessDataStream and com.ibm.as400.access.DBReplyRequestedDS are in unnamed module of loader clojure.lang.DynamicClassLoader @226b143b))"}}

Hi !

I tried to use the driver GitHub - damienchambe/metabase-db2-driver: AS400 / IBM i DB2 Driver for Metabase and it works but it tries to load all schemas found on my server ....
and it's a lot !
How can I configure only the needed schema ?