Testing your Db2 Community Edition Docker image installation on Windows systems

Once you have finished installing and configuring your Db2® Community Edition Docker image on your Windows machine, you can test it against the Db2 SAMPLE database.

About this task

You will create the Db2 SAMPLE database from the command line, after which you can run simple SQL commands against it to verify that your Db2 Community Edition instance is working inside the Docker container.

Procedure

  1. Enter the following commands to create a sample database and begin executing SQL commands:
    db2sampl -force -sql i
  2. Run db2 connect to sample.
    Once you are connected to the sample database, you can begin executing SQL statements, such as:
    db2 "select * from department" 
    to selects all the rows (* means all rows) from the table "department", or
    db2 "select * from department fetch first 1 rows only"
    to select the first row from the table "department". To change the number of rows retrieved, simply increase the number in the command.
  3. If the database returns the expected results, you can enter db2 connect reset 9 to terminate the Db2 database connection.
  4. Enter logout to end your Docker session.