Friday, August 2, 2024

Three plus one simple (and free) ways to test Db2

Getting started with Db2
Recently, I switched jobs and now want to set up a "playground" on my machine. First on the list is IBM Db2. So, what options are available to anyone to test Db2 and build up some Db2 skills? In this blog, I plan to provide an overview and share what I option I am going with. Why titled I this blog post "three plus one"? Because a possible solution for quickly testing Db2 queries is not really a full Db2 database. So let's start with that one...

dbfiddle for testing Db2 queries

If you are using question and answer sites like Stack Overflow / Stack Exchange, you probably are aware of dbfiddle.uk ("db<>fiddle"). It is a small web site where you can fiddle with database queries. Currently, it offers Db2 Developer-C v11.1.4.4 for testing out queries. The big benefit for using dbfiddle is that you get a permanent link to your session. Thus, you can easily share a scenario. It is not a full Db2 database and hence the "plus one" mentioned in the title.

I use dbfiddle for quickly testing basic SQL queries as sometimes needed to answer questions. It should be obvious that dbfiddle is not suited for confidential scenarios.

IBM Db2 on Cloud

Next on my list is IBM Db2 on Cloud. It is a fully managed Db2 as a service (database as a service, DBaaS), available on IBM Cloud. Db2 on Cloud is available with Standard and Enterprise plans. If you just want to test it and use it for non-production scenarios, there is even a free lite plan available. It has limited capabilities, but can still be used together with apps and other services to develop native cloud apps.

I am using the Db2 on Cloud lite plan since some years and have blogged about it and the use cases a couple times. The What's New in IBM Db2 on Cloud page has information about the latest features and service updates. Sometimes you will find features not available in the Db2 on-premises version yet.

Db2 Community Edition

Currently, the "regular (on-prem)" Db2 is offered in three editions: Db2 Community Edition, Db2 Standard Edition, and Db2 Advanced Edition. Db2 Community Edition provides all the core capabilities of Db2 at no cost. It is the free edition, only limited to its allowed use of 4 CPU cores and 16 GB of instance memory. Successors were Db2 Express-C (Express Community) and Db2 Developer-C (Developer Community) editions. You can download and install it like the other editions. See the FAQ at the end of the Get Started page for many answers to common questions.

I have used Express-C in earlier years and had it installed on my machine. But I moved on to the next, the third option.

Db2 Community Edition for Docker

 

Db2 Community Edition for Docker

The Db2 Community Edition for Docker is the containerized variations of the free Db2 offering. It is easily deployable by just pulling the container image and starting it up. The installation instructions for Linux are straight forward. Kelly Rodger has a blog post about getting started with Db2 Community Edition for Docker and using podman and skopeo instead of the docker command.

I have my Db2 up and running as you can see:

[db2inst1@db2server ~]$ db2 "values('Hello World, my Db2 is ready')"

1                           
----------------------------
Hello World, my Db2 is ready

  1 record(s) selected.


Conclusions

In this blog post, I showed some of the options available to Db2 without cost (free). You can utilize the Db2 on Cloud lite plan or the Db2 Community Edition. I am using the Db2 container (Db2 Community Edition for Docker) because it is easy to set up and manage.

That's it for today. If you have feedback, suggestions, or questions about this post, please reach out to me on Mastodon (@data_henrik@mastodon.social) or LinkedIn.