DB2 SQL5005C System error after installing TWS

By Pete Meechan

The cause of the problem

After installing DB2 on a Windows 2008 server any user that is not a member of the DB2ADMNS group will receive a pop-up error message box after login similar to the one shown below.

TWS-DB2 SQL5005C

This is caused by the default setting of DB2 attempting to start the DB2 system tray utility, which fails to start on Windows 2008 for users not in the DB2ADMNS group due to those users not having access to the DB2 files. Various entries on the IBM support site suggest disabling UAC (which I consider a bit drastic) or right-clicking the DB2 icon in the system tray and clearing the “Launch at start-up” option (as the icon in not present you can’t do this!) or adding every user with the problem to the DB2ADMNS group (I’m not sure that many DB2 DBAs would agree with this solution either).

The actual problem occurs because the autostart is placed in the registry key for “all users” and consequently every user login attempts to start the DB2 system tray utility. You can resolve this by deleting the offending registry key, but this would mean that it doesn’t get started for the db2admin user, or the Administrator user or (in our case) the twsuser user. “No big deal” you might say, but some people (non-DBAs particularly) would like to see the icon in the system tray as that is how they have always stopped/started DB2 or started the DB2 Control Center.

So whichever option you prefer, follow the instructions below to resolve the problem and remove this annoying error when users login.

Determine the DB2 instance name

All of the commands in this section must be executed from an Administrator Command Prompt –  right-click on the Command Prompt short-cut and choose “Run as Administrator”, then reply “Yes” to the prompt.

The default instance name for DB2 is “DB2COPY1” if installed during the installation of DB2. To verify the that is the name being used, execute the command shown below.

reg query HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun

This will display a list similar to the one shown below – the DB2 instance name is highlighted in orange

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun
    VMware Tools    REG_SZ    “C:Program FilesVMwareVMware ToolsVMwareTray.exe”
    VMware User Process    REG_SZ    “C:Program FilesVMwareVMware ToolsVMwareUser.exe”
    DB2COPY1 – db2systray.exe DB2    REG_SZ    C:PROGRA~1IBMSQLLIBBINdb2systray.exe DB2

Remove the error for all users

Before doing anything, backup the registry hive so that it can be restored if necessary using the command below – replace the file path/name (in red) as necessary

reg export HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun C:TempDB2sql_saved.reg

To remove the start-up of the DB2 tray icon for all users on Windows 2008 issue the command below – replace the DB2 instance name with the value from above.

reg delete HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun /v “DB2COPY1 – db2systray.exe DB2” /f

Execute the command below to verify that it has been successfully removed.

reg query HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun

and check the DB2 instance entry has been removed as shown below.

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun
    VMware Tools    REG_SZ    “C:Program FilesVMwareVMware ToolsVMwareTray.exe”
    VMware User Process    REG_SZ    “C:Program FilesVMwareVMware ToolsVMwareUser.exe”

If you do not want the DB2 system tray icon to start for any users, you are done. Otherwise continue with the next step.

Optionally add the start for selected users

To add the start of the DB2 system tray icon for selected users, take the following action for EACH user, but first take a copy of the file containing the exported registry data (e.g C:TempDB2sql_saved.reg) to another file (e.g. C:TempDB2sql_user.reg). The contents of this file will look similar to that shown below

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun]
“VMware Tools”=””C:Program FilesVMwareVMware ToolsVMwareTray.exe””
“VMware User Process”=””C:Program FilesVMwareVMware ToolsVMwareUser.exe””
“DB2COPY1 – db2systray.exe DB2″=”C:PROGRA~1IBMSQLLIBBINdb2systray.exe DB2”

Using the copy of the file (e.g. C:TempDB2sql_user.reg), edit the file so that only the lines shown in the sample below remain – note that the HKEY line has been updated to the current user registry key.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun]
“DB2COPY1 – db2systray.exe DB2″=”C:PROGRA~1IBMSQLLIBBINdb2systray.exe DB2”

Take the actions listed below to add the autostart for the selected user.

  • Add the user to the group DB2ADMNS to ensure they have the required access to the DB2 files
  • Login as the selected user (e.g. twsuser) wishing to start the DB2 system tray icon automatically at login
  • Execute the command below to add the autostart for the user currently logged in (e.g. twsuser)
reg import DB2sql_user.reg

If you later uninstall DB2 you will need to remove the autostart for each user individually as follows

  • Login as the selected user (e.g. twsuser) wishing to start the DB2 system tray icon automatically at login
  • Execute the command below to add the autostart for the user currently logged in (e.g. twsuser)
reg delete HKCUSoftwareMicrosoftWindowsCurrentVersionRun /v “DB2COPY1 – db2systray.exe DB2” /f

Visits: 271