By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

How to create DB2 DSN programmatically

P: 1
Hi there,
I want to create DSN for DB2 database through my VB application.
I have installed DB2 v8.2 with FixPack6.0 ESE.
(The actual version shown in Control Center is DB2 V8.1.13.193)

The problem is that VB application crashes without reporting any error. DSN is not getting created.
But I am able to create DSN through Control Panel.

Here is the code snippet to create DSN

ODBCDRIVER = "IBM DB2 ODBC DRIVER"
ODBC_ADD_SYS_DSN=4
' Add Application DSN First

att = "DSN=" & AppDSN & Chr$(0)
att = att & "Description=BPF Metastore System DSN" & Chr$(0)
att = att & "DBALIAS=" & AppDB & Chr$(0)
ret = SQLConfigDataSource(0, ODBC_ADD_SYS_DSN, ODBCDRIVER, att) ==> crashes at this line


But the same code creates DSN if i install DB2 v 9.1


Your help would be appreciated

Regards
Senthil
Feb 2 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.