Missing SYBASE environment variable

If the db2dj.ini file is not in the correct directory or if it is missing, you will encounter an SQL error.

Symptom

The following SQL error is issued:
SQL1822N Unexpected error code "" received from data source 
"server name". Associated text and tokens are "SYBASE variable not set"."

Cause

The db2dj.ini file was not found or the file does not contain the SYBASE environment variable. The db2dj.ini file is located in the directory that the Db2® registry variable DB2_DJ_INI specifies. When the DB2_DJ_INI variable is not set, the db2dj.ini file is in one of the following default paths depending on the operating system:
  • On UNIX: instancehome/sqllib/cfg/db2dj.ini.
    instancehome
    The home directory of the instance owner.
  • On Windows: %DB2PATH%\cfg\db2dj.ini
    %DB2PATH%
    The directory where the Db2 database system is installed, for example, C:\Program Files\IBM\sqllib.

Resolving the problem

Create a db2dj.ini file with the required Sybase environment variables and place it in the correct directory for your operating system. You can use a text editor to create the db2dj.ini file.