Thursday, April 26, 2007

ERROR [IM003] Specified driver could not be loaded due to system error 5 (IBM DB2 ODBC DRIVER)

Today was one of those "dog days", where you go to solve a problem and you get lead in to another, and if you google for a solution, you get 10 different answers none of which work and it drives you nuts.

But this was very tricky problem.

Here is the issue,
1) I use DB2, ASP.Net with vb.net code behind,
2) DSN is created in ODBC and sits on windows dsn,
3) Run regedit and go to HKEY_LOCAL_MACHINE >> SOFTWARE >> ODBC >> ODBC.INI >> select the name of the dsn >> Right click permissions >> Add the user name underwhich IIS runs (or) the current logged in user and give him read access (i gave full control)

4) Open mycomputer >> properties >> advanced tab >> Environmental Variables >> click path and add ;.; to the existing path at the end.
5) Restart the machine, since it is a odbc change we need to restart pc.

One problem leads to another:

  • When i went to try to restart (i was in remote desktop), i could not see the restart menu, since only disconnect is shown.
  • In such situations when we open task manager there used to be a menu called "Shut down" which would be visible, but unfortunately cannot see this too.
  • So one problem leads to another, how am i going to restart the damn pc.
  • Found solution at last, go to desktop and send Alt-F4 and then the shut down menu appears.
Logged back in and was able to login to the website, no ODBC errors.

The issue was there is this ODBC Key in the registry, the current user did not have read permission to read the key and the key told ASPNET where the db2 odbc driver was, so as we cannot read the key we cannot use the driver and hence cannot open a connection.

Great atlast it works :)