Technical Blog Post
Abstract
50 DB2 Nuggets #10 : Resource Info - ODBC DSN configuration with db2cfexp and db2cfimp utilities on Windows Operating System
Body
Export from 64-bit windows - machine 1, import to 64-bit Windows- machine 2:
- db2cfexp with template/backup option on machine 1 (may contain both 32 and 64-bit ODBC DSN)
example: db2cfexp template <template.txt>
- db2cfimp on machine 2
example: db2cfimp template.txt
64-bit ODBC DSN:
All 64-bit ODBC DSN's are imported. No additional steps required
32-bit ODBC SYSTEM DSN:
Manually issue: db2cli32 registerdsn -add -alldsn -system
Or
Using 32-bit ODBC Administrator: Open windows explorer Go to: C:\Windows \syswow64\odbcad32.exe
System DSN tab ->configure
--------------------------------------------
Export from 32-bit windows-machine 1, import to 64-bit Windows - machine 2:
- db2cfexp with template/backup option on machine1
- db2cfimp on machine 2
64-bit ODBC SYSTEM DSN (register new):
a) Catalog all nodes/dbs/dcs (if host systems are involved)
b) db2cli registerdsn -add -alldsn -system
or
db2 catalog system ODBC Data Source <dsn name> (for single DSN)
db2 catalog system ODBC ALL DATA SOURCES (to register all databases as ODBC DSN)
or
Configure the db using configuration assistant to register the database as ODBC DSN
or
Control Panel->Administrative tools->ODBC Data sources->System DSN tab ->configure
32-bit ODBC SYSTEM DSN:
Manually issue: db2cli32 registerdsn -add -alldsn -system
or
Use 32-bit ODBC Administrator: Open windows explorer Go to: C:\Windows \syswow64\odbcad32.exe
Note: You cannot register 32-bit ODBC DSN using Configuration Assistant since there is a restriction (see below), you would have to use 32-bit ODBC Administrator or db2cli32 instead as described above. Moreover, Configuration Assistant has been discontinued starting DB2 V10.1.
Restrictions:
Useful tips about db2cli/db2cli32:
- db2cli32 is present in DB2 V9.7 PF4 and higher.
- db2cli32.exe is part of DB2 64-bit products, it is used to register 32-bit ODBC DSN's on 64-bit Windows.
- 32-bit DB2 products come with only db2cli.exe which is used to register 32-bit ODBC DSN.
References:
db2cfexp:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0002442.html
db2cfimp:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0002441.html
db2cli - DB2 interactive CLI utility:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0002045.html
CATALOG NODE command:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0001944.html
CATALOG DCS DATABASE command (for z/OS and i-series):
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0001937.html
CATALOG DATABASE command:
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0001936.html
CATALOG ODBC DATA SOURCE command
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0002030.html
Setting up the Windows CLI environment
http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.cli.doc%2Fdoc%2Ft0006416.html
UID
ibm11141390