First test is always to run some other X program to see if you have your X configuration working. For example, try "xterm". If that doesn't work, then you'll need to get that working before db2setup will work.

Most likely, you became root using "su -" - which generally does not preserve xauth authentication. You can either learn how xauth works (see the xauth man page), or you can bypass it altogether with the less secure "xhost +localhost" command (as yourself - not root). This means that anyone logged into the local box, even from remote, will be able to launch X programs and the X server will allow it. Which, if you're behind a firewall and no one else can access your box, is the same security anyway. However, if a malicious person got into your box, they'd be able to launch a keylogger to read your passwords and the like. That's why xauth is generally preferred now - but the old host-based method is still available when it makes sense.

I faced the same issue in UBUNTU 8.04 LTS while installing DB2 Express C 9.7, it was throwing error "The DISPLAY variable is not set propterly. Ensure that the DISPLAY variabler is set properly and that permissions are set properly to open windows on the display specified, then rerun the command.". However, the install went thru fine after I changed the SHELL to ksh (the default was bash) and reran the db2setup again.