For a proof-of-concept Yves Groenen was asked to make a connection from Excel powerquery to an IBM DB2 database. Read more about his findings.
For a proof-of-concept I was asked to make a connection from Excel powerquery to an IBM DB2 database. Since I didn’t have a server somewhere with DB2 installed on it, I went searching for a solution. A thing to keep in mind is that this post isn’t a deep dive into DB2, but a connectivity test between Excel and DB2.
First let’s go over the environment and tools that I used to set up Excel- and the DB2 (note: it’s best you create an account with IBM which allows you to download the IBM tools listed here):
Installing DB2 Express-C database server. First, I created an IBM account since this is a prerequisite if you want to download their software. After that I downloaded the DB2 Express-C database server v10.5.1 (64 bit) for Windows. When we run the installer, you will have the following overview:
We will be doing a fresh installation so click Install New. I used the typical installation. You can view the features provided by a typical installation:
On the next page you will have to choose if you want to install DB2, create an RSP file or do both. I’ve chosen the latter. You could look at the RSP file as the equivalent of the configuration file in SQL Server. This way you can install new deployments with the same configuration. As in SQL Server this file should be used in command line installation:
This file also comes in handy when you want to check out the settings you used after an installation.
Next you choose the install folder for DB2 express –C and the IBM SSH server installation. If you already performed another DB2 installation on your computer, you will get an extra step: DB2 copy name. Starting from version 9, multiple DB2 copies can be installed on the same machine. This name will be used to distinguish these installations:
Also mind the comment here regarding default application connections.
Next you will have to set the user information that will be used to run the DB2 administration server and the other DB2 services. For this example, I created a local administrator account. Also, in DB2 you can’t create database users. They must be created at the OS level:
Next you will see the instance that will be installed. You can configure different options regarding TCP/IP, Named Pipes and whether the service should run at system startup. I will use the defaults:
Finally, we get an overview of our installation settings. We have finished the installation. After this you will get a DB2 first steps screen where you will find different items to get you started. You could get a sample database generated, but later in this post we will create one ourselves.
I’m not going to walk through the installation steps since it’s straight forward. The download will be done through IBM’s download manager found here.
In case you haven’t installed powerquery yet, it can be downloaded and installed as an add-in for Excel.
For managing DB2 we have the data studio we installed, but we also have a command line-based tool at our disposal. For the creation of the database and a test table, we will use the command line tool. For filling up the table, we will use data studio (I’m doing all the following steps while logged on under my domain account (domain\groenyv), not the db2_dba local admin account. So, all the objects created will be created under this domain account).
First run the DB2 command window:
You notice you are going to the install folder. On this path you will find different applications you can use to manage your DB2 environment. We will use db2.exe.
Then we simply issue a create database statement:
To list all the databases, issue the following command:
To connect to this database, we must issue the following command:
Notice that the authorization ID is my domain account.
Next, we create a test table. To get an overview of all the tables issue the following command:
Notice that the table schema is my domain account.
Next, we create a test table:
To get an overview of all the tables issue the following command:
Notice that the table schema is my domain account.
For this part we will use the data studio which provides a graphical user interface much like SQL Server management studio. First, we connect a new database connection:
There we use the default IBM Data Server Driver and fill in the database info. Then you can test connection:
After that we open a query window. You will have to select the database connection we just created. Then we do some simple inserts and a select:
So now we are ready to open Excel to connect and extract this data.
Open Excel
Open the powerquery tab
Select “From database” and click on IBM DB2 database:
Specify the server, the database and the SQL instruction:
And finally, we get to see our DB2 data in Powerquery:
In case you are experiencing problems connecting because the IBM DB2 Data Server Driver is not installed on the computer, you should visit the following page.
© 2023 Kohera
Crafted by
© 2022 Kohera
Crafted by
Cookie | Duration | Description |
---|---|---|
ARRAffinity | session | ARRAffinity cookie is set by Azure app service, and allows the service to choose the right instance established by a user to deliver subsequent requests made by that user. |
ARRAffinitySameSite | session | This cookie is set by Windows Azure cloud, and is used for load balancing to make sure the visitor page requests are routed to the same server in any browsing session. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category. |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie. |
elementor | never | The website's WordPress theme uses this cookie. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
__cf_bm | 30 minutes | Cloudflare set the cookie to support Cloudflare Bot Management. |
pll_language | 1 year | Polylang sets this cookie to remember the language the user selects when returning to the website and get the language information when unavailable in another way. |
Cookie | Duration | Description |
---|---|---|
_ga | 1 year 1 month 4 days | Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors. |
_ga_* | 1 year 1 month 4 days | Google Analytics sets this cookie to store and count page views. |
_gat_gtag_UA_* | 1 minute | Google Analytics sets this cookie to store a unique user ID. |
_gid | 1 day | Google Analytics sets this cookie to store information on how visitors use a website while also creating an analytics report of the website's performance. Some of the collected data includes the number of visitors, their source, and the pages they visit anonymously. |
ai_session | 30 minutes | This is a unique anonymous session identifier cookie set by Microsoft Application Insights software to gather statistical usage and telemetry data for apps built on the Azure cloud platform. |
CONSENT | 2 years | YouTube sets this cookie via embedded YouTube videos and registers anonymous statistical data. |
vuid | 1 year 1 month 4 days | Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. |
Cookie | Duration | Description |
---|---|---|
ai_user | 1 year | Microsoft Azure sets this cookie as a unique user identifier cookie, enabling counting of the number of users accessing the application over time. |
VISITOR_INFO1_LIVE | 5 months 27 days | YouTube sets this cookie to measure bandwidth, determining whether the user gets the new or old player interface. |
YSC | session | Youtube sets this cookie to track the views of embedded videos on Youtube pages. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt-remote-device-id | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt.innertube::nextId | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
yt.innertube::requests | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
Cookie | Duration | Description |
---|---|---|
WFESessionId | session | No description available. |