Link to home
Start Free TrialLog in
Avatar of inversojvo
inversojvoFlag for Germany

asked on

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

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.
Avatar of peakpeak
peakpeak
Flag of Sweden image

Avatar of inversojvo

ASKER

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...
momi_sabag:
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 https://www.experts-exchange.com/questions/24996547/How-to-catalog-db2-database-with-visual-basic-vb-or-vba.html, the question there will be closed)
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 10.128.252.60 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?
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry for late answer and thanx for the help!!