IBM Support

SQL8002N error due to %SystemDrive% environment variable missing

Troubleshooting


Problem

SQL8002N error due to %SystemDrive% environment variable missing

Symptom

On a properly licensed DB2 Connect installation, It may be possible to connect to mainframe DB2 databases (such as DB2 for z/OS, DB2 for iSeries, or DB2 for VM/VSE) from the DB2 CLP and from an ODBC test connection. However, from a specific application, such as a web application running under Apache web server, the following error may occur:

SQL8002N An attempt to connect to a host failed due to a missing DB2 Connect product or invalid
license. SQLSTATE=42968.

Cause

The licensing code requires the %SystemDrive% environment variable to be set in order to locate the nodelock file on the system. In the specific environment where the SQL8002N error is occurring, %SystemDrive% is not set and DB2 cannot find the nodelock file in order to confirm that a DB2 Connect license exists on the system.

Diagnosing The Problem

1) Check to see if the system has a correct DB2 Connect license applied. Run the command "db2licm -l" and look for a DB2 Connect product edition that has an expiry date that is not expired.

Product name: "DB2 Connect Enterprise Edition"
License type: "User"
Expiry date: "Permanent"

2) If the DB2 Connect license is not Permanent, then this is likely the reason for the SQL8002N error message. Follow the instructions at the following link to obtain the DB2 Connect license.



How do I download my DB2 license from Passport Advantage
http://www-01.ibm.com/support/docview.wss?uid=swg21305417

3) If the DB2 Conect license is applied and the SQL8002N error is still occurring, verify the value of the %SystemDrive% environment variable to ensure it is correctly set to a value such as "C:". This value can typically be found by running the "set" command.



C:\> set | FIND "SystemDrive"
SystemDrive=C:

However, the application that is having the problem may be using it's own custom environment variables that do not match the default variables that are shown from the "set" output.

Resolving The Problem

Correct the application environment and ensure the %SystemDrive% environment variable is properly set to the correct value. In most cases the system drive is "C:". The environment variables may be getting set by the particular application's configuration settings. Please consult the documentation for the specific application that is having this problem to determine where the environment variables are defined for the application.

Related Information

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Install\/Migrate\/Upgrade - Licensing","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.7;9.5;10.1;10.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21625156