Sign inSign up

scottysinclair/db2-express-sr

By scottysinclair

•Updated over 9 years ago

Extends the db2 image with Java with a Java SQL script executer

Image
0

363

scottysinclair/db2-express-sr repository overview

⁠This dockerfile takes the db2-express image with Java8 installed and installs the

⁠small dbscript executer program which executes scripts on a 1 time basis.

⁠It moves the scripts from a "todo" to a "done" folder to indicate that the file was processed

⁠

⁠This means that if the same container is stopped and started then the DB2 will simply start

⁠and will not try and recreate the schema.

⁠

USER db2inst1

RUN mkdir /home/db2inst1/script-executor &&
mkdir /home/db2inst1/script-executor/todo

COPY db-script-executer-1.0.0-SNAPSHOT.jar /home/db2inst1/script-executor RUN echo "jdbc.url=jdbc:db2://localhost:50000/test" > /home/db2inst1/script-executor/jdbc.properties &&
echo "jdbc.user=db2inst1" >> /home/db2inst1/script-executor/jdbc.properties &&
echo "jdbc.password=password" >> /home/db2inst1/script-executor/jdbc.properties &&
echo "jdbc.driver=com.ibm.db2.jcc.DB2Driver" >> /home/db2inst1/script-executor/jdbc.properties

#Create a log4j properties file COPY log4j.properties /home/db2inst1/script-executor/

⁠Create the run script which launches the Java ScriptExecuter application

RUN echo "#!/bin/bash" > /home/db2inst1/script-executor/run.sh &&
echo "cd /home/db2inst1/script-executor/" >> /home/db2inst1/script-executor/run.sh &&
echo "java -Dlog4j.configuration=file:log4j.properties -cp db-script-executer-1.0.0-SNAPSHOT.jar com.scott.dbscriptexecuter.ScriptExecuter" >> /home/db2inst1/script-executor/run.sh &&
chmod uga+x /home/db2inst1/script-executor/run.sh

ENTRYPOINT . /home/db2inst1/sqllib/db2profile && db2start && /home/db2inst1/script-executor/run.sh && echo "DB2 Ready" && tail -f /dev/null

Tag summary

Content type

Image

Digest

Size

967.2 MB

Last updated

over 9 years ago

docker pull scottysinclair/db2-express-sr