Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly.
Hypersistence Optimizer is that tool!
While developing Hibernate, I need to test the code base against a plethora of relational database systems: Oracle, SQL Server, PostgreSQL, MySQL, MariaDB, Informix, and of course DB2.
However, having all these databases installed on my system is far from ideal, so I rely a lot on Docker for this task. In this article, I’m going to show how easily you can install DB2 on Docker and set up the JDBC connection so that you can run Hibernate tests on DB2.
Installing the DB2 Docker container
Nowadays, all major RDBMS providers offer official Docker images on DockerHub, and IBM is no different. The Express-C edition can be fetched automatically during Docker container set up.
To create a new DB2 Docker container on Windows, you need to run the following command:
If you enjoyed this article, I bet you are going to love my Book and Video Courses as well.
Docker makes database testing a breeze. You can have as many database systems you need set up in Docker without having to bloat your currently running operating system.
Another great advantage of having your testing databases on Docker is that you can simply copy the Docker machine file from one system to another, which is ideal when you switch to a new notebook or when you have to share the default database containers with the rest of your team.
Based on my book, High-Performance Java Persistence, this workshop teaches you various data access performance optimizations from JDBC, to JPA, Hibernate and jOOQ for the major rational database systems (e.g. Oracle, SQL Server, MySQL and PostgreSQL).