Db2

In this example we’ll

  • Upload data onto a table in Db2
  • Export data from Db2

Upload Data to Table


Data

The first dataset used in this lab comes from the following source: https://dataplatform.cloud.ibm.com/exchange/public/entry/view/5562ced564e776edc5f91e13d48d8309?context=cpdaas. This dataset is published by IBM, and Contains point data for a sample list of hospitals in US. 

  • First, you’ll want to go ahead and download the dataset you are going to use in this lab. You can do so by clicking on the following: hospitals.csv
  • Open IBM Db2 instance
  • GO to the instance
  • Manage > Go to UI
  • Left Tab click on the Data icon
  • Drag the data file from above that was downloaded locally
  • Next
  • Click on New Table
  • Name it: HOSPITALS > Create > Next
  • Review the data
  • Lower right > Begin Load
  • When done > View Table

Export Systable


We will export a table from the database into a csv file. In particular, you will export a Db2 System Table called SYSTABLES, which stores metadata about all other database objects.

We won’t get into much detail about System Tables. For now, we can treat it as just a table we wish to export. Let’s get started.

  • Click SQL icon on the left
  • Create new
SELECT * FROM SYSIBM.SYSTABLES;
  • Run all

You will see the result of the query displayed on a window on the right half of the webpage. Above the result preview, click the indicated download button to export the table as a csv file.