First I used SQLConnect to connect to the ODBC driver which fine, however I discovered that I need to enable UNICODE in my app so I have set the UNICODE flag in the preprocessor definitions which calls SQLConnectW, my problem is that SQLConnectW fails to connect and returns -1.
I have no idea what's wrong and why SQLConnect works and SQLConnectW doesn't...
From odbcad32, can you successfully connect to the db2 database with those credentials?
If you can connect successfully there, you might have made a programming error.
If that is the case, please follow the sample code provided by IBM .
The file(s) containing the sample code live on the DB2 server in the directory SQLLIB / samples/ cli.
The samples are also available on-line at CLI samples - IBM DB2 9.7 for Linux, UNIX, and Windows
[QUOTE=DB-layer;6564140]then I opened the ODBC Data Source Administrator and created a new user DSN using the IBM DB2 ODBC DRIVER version 9.07.01.462.[QUOTE]
DB-layer, I don't know much about DB2, but for us a DSN created with the windows data source administrator does not connect. The only way we could connect is by creating the DSN with DB2 Connect configuration assistant. I feel the windows application *should* work, and maybe there is a way to do it, but were not successful with it.