How to access tables of DB2 in Excel

Dear Experts,

Could you please help to know how to access tables from DB2/AS400 in MS-Excel to use PivotTable.

Please give me step by step process.
Syed Shareef AhmedSenior System AnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:
Hi Syed,

The process can vary a bit depending your desktop environment, but it will go something like this:

-  Open the Control Panel (assuming that you're running a Windows desktop).
-  Open 'Administrative Tools'
-  Open 'Data Sources (ODBC)
-  Under User DSN, Select 'Add' on the right side of the dialog box.
   All of the drivers installed on your desktop will be displayed.
-  Select the IBM DB2 ODBC DRIVER driver.
   If no DB2 driver exists on your desktop, you'll need to install one or user a generic driver.

Once you've create the DSN entry, you can link the data from Excel with 'External Data' / 'From Other Sources'.  Use the Data Connection Wizard or go straight to the DB2 DSN entry.

Good Luck!
Dave FordSoftware Developer / Database AdministratorCommented:
When it comes to DB2, Kent is the premiere expert, and I would trust whatever methodology he suggests.

Just in case you have problems with that methodology, I've usually had more success importing my DB2 data into Microsoft Access first, massaging it there, and exporting to Excel.

You'll still need a valid ODBC data-source, but from within Access, you click the "External Data" tab, the "ODBC Database" button, and select "Import Source Data into new table". It'll then present a list of ODBC data-sources from which to choose. Once that's chosen, it'll present a list of tables to import. Just select the one you want and click OK.

Syed Shareef AhmedSenior System AnalystAuthor Commented:
Hi Kent & DaveSlash,

Thanks for the steps provided and sorry for my late response.

Please find attached of two files one for ODBC setting I have done, another for trying to extract data in Excel from DB2.

If you look my second attached file, I could not see the libraries and tables i want to access.

I don't know where I am missing.
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Dave FordSoftware Developer / Database AdministratorCommented:
You'll notice in your ODBC settings that the "SQL default library" is set to QGPL. Change that to whatever schema (a.k.a. library) your tables live in. That's the quickest and easiest way.

Another option would be to change the "naming convention" in the ODBC to *SYS and specify all the relevant schemas in the "library-list" value.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tomas Helgi JohannssonCommented:

As Kent mentioned you need to use the IBM DB2 ODBC DRIVER driver.
Make sure that you have the latest/newest version of DB2 Data Server Client or Personal Connect Client  that supports your DB2 Server.
Also make sure that that Driver and Office are BOTH 64 bit OR 32 bit versions.
Otherwise you have compatibility issues.

     Tomas Helgi
Dave FordSoftware Developer / Database AdministratorCommented:
I think Kent (kdo) deserves to be part of the points-split.
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.