[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to catalog db2 database with visual basic (vb or vba)?

Posted on 2009-12-22
Medium Priority
Last Modified: 2013-12-25
Appr. 50 users access an MS Access application, from where the connection to DB2 database via ODBC has to be used. I know, how to build an ODBC connection to a registered (with "catalog db") DB2 database. But most of users have this DB2 database not catalogged yet. How to catalog a DB2 database from VBA-code? The server (IP), database name and port are known.
Question by:inversojvo
  • 4
  • 2
LVL 28

Expert Comment

ID: 26103165

Author Comment

ID: 26103239
2 peakpeak: these are descriptions of connecting to DB2 database, that is already catalogged on the client PC. I need the answer, how to catalog the DB2 database, that wasn't catalogged yet. I can do it from CLI manually, but I don't wont to do it manually on each of 50 clients PC and to go to client each time, when new PC is installed.

I know, how to build ODBC connection to exisiting DNS source, I know how to create DNS source from vba, but how to catalog the DB2 database?? I suppose, I could do it with registry entry, but may be, the easier way does exist, with some predefined VB libraries or so...
LVL 37

Expert Comment

ID: 26103242
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 26111814
you can try to use some cli api in order to do it, but it will probably be rather complex
if you can just invoke the db2cfimp.exe file, you can prepare a configuration export file with the appropriate cataloged entry and then import it from your code

(copied from http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_DB/Q_24996547.html, the question there will be closed)

Author Comment

ID: 26111877
2 momi_sabag: I don't understand quite well - do you mean, that I have to prepare the configuration file with the "catalog" command and then just call db2cfimp.exe with the configuration file name as parameter?

F.e.x. if I can catalog the node and then the db, that I need, with the following commands from CLI:

db2cmd db2 catalog tcpip node AXDAB02T remote server 50009
db2cmd db2 catalog db RISITEST at node AXDAB02T

So, you mean, that I make a file "catalog.cfg" with 2 this lines and call the from VBA smth. like shell(<pathToDb2cfimp>/db2cfimp.exe <pathToCfg>/catalog.cfg), the cataloging will be made?
LVL 37

Accepted Solution

momi_sabag earned 2000 total points
ID: 26112000
you can either run those commands,
or run db2cfexp on a compuer with that database catalog, db2cfexp will produce a file you can later use as input for db2cfimp

Author Closing Comment

ID: 31668904
Sorry for late answer and thanx for the help!!

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question