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.


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"."


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.
    The home directory of the instance owner.
  • On Windows: %DB2PATH%\cfg\db2dj.ini
    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.