DB2 9 and Microsoft Excel 2007 - Part 1: Get data

DB2 - The largest, strongest and fastest database management system in the world today developed by IBM. Compared to Oracle, its main and most powerful competitor, DB2 is not as well known. But believe that in the near future, DB2 is the next choice for database management generation besides Microsoft Server or Oracle of Oracle.

Surely many readers of TipsMake.com will feel quite confused with DB2 8.5 or DB2 9.2. This series will introduce some of the DB2 9 application methods with Microsoft Excel 2007. Hopefully they will be useful for those who are interested in DB2, the future management system of the database.

Part 1: Insert DB2 9 data into Microsoft Excel 2007

To put data into Excel 2007 files from the DB2 Data Server, you need to start with a connection (database connection). This function is supported in Excel 2007, on the Data tab (see image below).

Data tab is a new function in Microsoft Excel 2007. With Excel 2007, you can perform a lot of data functions besides common operations like formatting, editing. Most notably, you can import data from various sources into Excel. To enter data, use the ' Get External Data ' function (in the left pane of the Data tab). That's exactly what you need when you want to import DB2 9 data into an Excel 2007 file.

To import the data content of the STAFF table into the Excel 2007 worksheet, follow these steps:

1. In the ' Data ' tab, select ' From Other Sources '> ' From Data Connection Wizard ' in the ' Get External Data ' box:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 1

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 2

As you can see in the image above, Excel 2007 supports importing data from various sources (sql server files, sql server analysis services, xml, Microsoft query) into the worksheet. But in the context of this article, we will import the data of DB2 9, which is not defined in Excel 2007, so you need to select ' From Data Connection Wizard '.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 3

2. The ' Data Connection Wizard ' window opens, select ' Other / Advanced ' and click ' Next '.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 4

3. Open the ' Data Link Properties ' window, select ' IBM OLE DB Provider for DB2 ' in ' OLE DB provider (s) ' and click ' Next '.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 5

When you install DB2 9 client on your machine, the corresponding 'OLE DB provider' will also be installed automatically. And Excel 2007 will use this component to retrieve data from the DB2 database.

The illustration in step 2 shows the method for you to choose the type of ' ODBC DSN '. When the data source is entered as a DB2 database, you can choose the type of database configuration that is the user (user), system (system) or a DSN file using the Windows utility available - the Data Source function ( ODBC). My SAMPLE sample database is configured as a system DSN file, so I can also use this connection to query data instead of just putting data into an Excel 2007 file.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 6

4. Select the database you want to connect from the ' Specify the DB2 database ' box. Enter the correct login information for your database in the ' Log on Information ' box and click ' Test Connection '.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 7

If the database you want to connect to is not in the type defined on the machine running Microsoft Excel 2007, you can search for existing Data Servers and their databases (as well as DB2 Connect entries if you want to Create additional DB2 connections to machine I or DB2 for Z machines using the ' DB2 Discovery ' component built into Excel. You can do another type by selecting the ' Direct server connection ' button and selecting a database from the ' Select the database on the server ' list (click the ' Refresh ' button to update the server list and list). Latest database before selection).

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 8

Somewhat out of the scope of this article a bit, but it is better to note that you can use the ' Advance ' function to set advanced properties for this connection. For example, set the timeout for connecting to 'time-out', or create a hard-coded password.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 9

5. Click ' OK ' when connecting successfully.

The DB2 OLE DB Provider is usually fully integrated in Excel 2007. For example, if Excel 2007 cannot connect to the SAMPLE database because the database instance is down, an error message as shown below will be displayed:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 10

If this database is being used (maybe because it is in a silent state or a backup process is being performed), Excel 2007 will display an error message:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 11

6. The ' Data Connection Wizard ' opens. Select the table with the data you want to import into Excel 2007 and click ' Next '. For example, you can select the content of the STAFF table located in the SAMPLE database.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 12

Note : To create the SAMPLE database in DB2 9, you need to enter the db2sampl statement from the operating system's Command Prompt screen.

7. You may optionally leave the information for this connection or not. But it will be better if you record it to be reused later. After that, click the ' Finish ' button.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 13

If you do not want to record this connection in the future, simply click the ' Finish ' button in the previous step. In the image above you can see that I have recorded the current database connection (which is the only connection to the STAFF table) for future use. You can optionally add a description for this connection object (in the ' Description ' field) and search for the metadata (in the ' Search Keywords ' field) to make the following query times easier. Finally, note that you can set good controls for the authentication section by clicking ' Authentication Settings '.

8. The ' Import Data ' window opens. Use this window to describe where the data will be placed in Excel 2007 worksheet. You can select the default values ​​and press OK .

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 14

As you can see in the image above, the DB2 data store can be either Table or Pivot Table Report or both. I will discuss them in the next article. (If you want to configure in more detail the properties of the connection string, click the Properties button.)

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 15

The Excel 2007 worksheet will display form data:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 16

Of course, at this point you can adjust the display data to suit you through formatting functions strongly support in Excel 2007 and apply Table Style style for tables from the Design tab. Eg:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 17

You can use the ' Table Style Options ' function in the Design tab like:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 18

When the data is downloaded to Excel 2007, you can use the ' External Table Data ' function in the Data tab to manage the database connection. For example, select Unlink will separate data from the table and turn them into independent:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 19

And you can quickly filter the returned data without writing any SQL command line:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 20

One of the things I really like about Excel 2007 is the powerful charting feature. Using this method you can easily display your DB2 9 data as charts.

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 21

In the chart above you can see the salary and commission percentages for 5 employees in room 20. Of course, as long as you don't disconnect the log file, you can refresh the data, the chart will be Update immediately. For example, run the following DML command to change the percentage of Pernal commission achieved (Pernal is an employee in the chart):

UPDATE TABLE STAFF SET COMM = 55565.56 WHERE ID = 20

Now refresh the data:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 22

And of course, the base data is also updated:

DB2 9 and Microsoft Excel 2007 - Part 1: Get data Picture 23

Let us rethink how to use the most common form of data with Excel: segmenting data into an unofficial Data Server. So, if your real data changes, when will your analysis for real data be? Let's wait for the answer in the next post.

Summary

In this article we have seen how easy and easy it is to import DB2 9 data into Excel 2007 files. Besides, we also know some useful components to change the way data is displayed. Marketing (using different functions of Table Tools) as well as how to create a chart in Excel and how to refresh real data.

4 ★ | 2 Vote

May be interested

  • Complete guide to Excel 2016 (Part 9): Working with multiple spreadsheetsComplete guide to Excel 2016 (Part 9): Working with multiple spreadsheets
    excel workbook file is a collection of spreadsheet types (can contain from 1 to 255 spreadsheets) such as: data, graphs, macro, . and often related to each other.
  • How to Download Microsoft ExcelHow to Download Microsoft Excel
    this wikihow teaches you how to download microsoft excel onto your computer, smartphone, or tablet. while microsoft excel for computers can only be downloaded as part of the microsoft office bundle, you can download excel by itself for...
  • How to Find Duplicate Data in ExcelHow to Find Duplicate Data in Excel
    when working on microsoft excel spreadsheets with lots of data, it is likely that you will encounter duplicate values. microsoft excel's conditional formatting feature will correctly display duplicate locations, while the remove duplicates action will remove those entries. reviewing and removing duplicates ensures the accuracy of your data and presentation.
  • Change color between different lines in Microsoft ExcelChange color between different lines in Microsoft Excel
    selecting and shedding colors separately for data areas is especially useful when you have a spreadsheet with lots of different statistics. in the following article, we will show you some steps to do this in microsoft excel ...
  • How to automate Vlookup with Excel VBAHow to automate Vlookup with Excel VBA
    vlookup is an essential function in excel and has become an important part of data processing. it provides a number of functions that you can combine with a comprehensive database.
  • Transfer form data from Word to ExcelTransfer form data from Word to Excel
    microsoft excel is a powerful spreadsheet database management application. if you are using a word application to collect user data, it is necessary to transfer all of this data to an excel spreadsheet for management. besides, data conversion is a job with multiple records (record) and field (field) data.
  • How to Make a Line Graph in Microsoft ExcelHow to Make a Line Graph in Microsoft Excel
    this wikihow teaches you how to create a line graph from microsoft excel data. you can do this on both windows and mac versions of excel. open microsoft excel. double-click the excel program icon, which resembles a white 'x' on a green...
  • How to Create a Random Sample in ExcelHow to Create a Random Sample in Excel
    this wikihow teaches you how to generate a random selection from pre-existing data in microsoft excel. random selections are useful for creating fair, non-biased samples of your data collection. open the microsoft excel program. you can...
  • Types of data hiding in Excel - Part end: Hide Excel FilesTypes of data hiding in Excel - Part end: Hide Excel Files
    today tipsmake will show you the last part: 'hide excel file' in the series 'guide all types of hidden data in excel extremely useful'.
  • Microsoft Excel test - Part 4Microsoft Excel test - Part 4
    in this article, go with microsoft network administrator to learn about microsoft excel through multiple choice questions.