PLEASE NOTE: This extended functionality is available in Steam Version 1.8.8 onwards.
On a high level the steps look like this:
Doc for JDBC setup:
https://s3.amazonaws.com/artifacts.h2o.ai/releases/ai/h2o/dai/rel-1.9.3-19/docs/userguide/connectors/jdbc.html?highlight=jdbc#queryexamples
https://s3.amazonaws.com/artifacts.h2o.ai/releases/ai/h2o/dai/rel-1.9.3-19/docs/userguide/connectors/jdbc.html?highlight=jdbc#queryexamples
- Create Image with the Jar file and upload to an accessible repo
Create a text dockerfile
FROM centos:centos7
RUN \
yum update -y &&\
yum install wget -y\
java-1.8.0-openjdk
RUN mkdir /database_jar
RUN wget --no-check-certificate https://jdbc.postgresql.org/download/postgresql-42.2.24.jar -P /database_jar/
Build image
docker build -f dockerfile -t hdfc_image .
->Add tag to new image
# docker tag hdfc_image h2oai/tmp:hdfc_image
->Push to Docker hub , For example (https://hub.docker.com/repository/docker/h2oai/tmp)
#docker push h2oai/tmp:hdfc_image
AlternativelyWe can also use Amazon ECR instead of docker hub.
2. Add settings to Steam profile
Config.TOML (Override the below settings):
enabled_file_systems = "upload, file, hdfs, s3, recipe_file, recipe_url, jdbc"
jdbc_app_configs = """{
"postgres": {
"url": "jdbc:postgresql://ec2-3-215-184-140.compute-1.amazonaws.com:5432/postgres",
"jarpath": "/dai-data/postgresql-42.2.24.jar",
"classpath": "org.postgresql.Driver"
}
}"""
Add lines below to “init containers”:
initContainers:
- name: hdfc
image: h2oai/tmp:hdfc_image
command: ["/bin/sh", "-c", "cp -r /database_jar/postgresql-42.2.24.jar /dai-data"]
volumeMounts:
- mountPath: /dai-data
name: data
3. Restart DAI and we should be able to connect to the DB.
a) Click on Add Dataset and select JDBC