Last week, I was trying to check the version of my Db2 client on my laptop and I got an unexpected error message.

This was odd as my laptop had plenty of memory, so I tried a couple more commands.

C:\WINDOWS\system32>db2licm -l
Product name:                     "IBM DB2 Developer-C Edition"
License type:                     "Community"
Expiry date:                      "Permanent"
Product identifier:               "db2dec"
Version information:              "11.1"
Max amount of memory (GB):        "16"
Max number of cores:              "4"
Max amount of table space (GB):   "100"
C:\WINDOWS\system32>db2start
SQL6031N  Error in the db2nodes.cfg file at line number "1".  Reason code "10".

Oh!, the Db2 service was actually down and now I remembered that I've changed the hostname on my laptop.

So I tried to find more information about this error message.

This can be done with: db2 ? SQLcode.

D:\Program Files\IBM\SQLLIB\BIN>db2 ? SQL6031N


SQL6031N  Error in the db2nodes.cfg file at line number "<line>". Reason
      code "<reason-code>".

Explanation:

The statement cannot be processed because of a problem with the
db2nodes.cfg file, as indicated by the following reason codes:


10

         The hostname at line "<line>" of the db2nodes.cfg
         file in the sqllib directory is not valid.


User response:

The action corresponding to the reason code is:
10

         Ensure the hostname value defined in db2nodes.cfg at line
         "<line>" is both defined on the system and
         operational.

So I checked my hostname, with the following command.

C:\WINDOWS\system32>hostname
lenovot480

and found my db2nodes.cfg

C:\WINDOWS\system32>d:

D:\>cd D:\ProgramData\IBM\DB2\DB2COPY1\DB2

D:\ProgramData\IBM\DB2\DB2COPY1\DB2>dir
 Volume in drive D is New Volume
 Volume Serial Number is 0CC6-2C4E

 Directory of D:\ProgramData\IBM\DB2\DB2COPY1\DB2

06/01/2019  14:02    <DIR>          .
06/01/2019  14:02    <DIR>          ..
05/01/2019  22:14    <DIR>          cfg
20/03/2020  17:50    <DIR>          ctrl
06/01/2019  14:02             1,093 db2cache.prf
06/01/2019  13:16             1,120 db2dbamr.prf
06/01/2019  14:02             3,060 db2misc.prf
05/01/2019  22:14                34 db2nodes.cfg
05/01/2019  22:14                32 db2profile.bat
06/01/2019  14:02             2,071 db2repl.prf
06/01/2019  13:17             2,071 db2repl.prf.bkp
06/01/2019  14:02               252 db2ReplAux.prf
05/01/2019  23:48                82 db2ReplAux.prf.backup
20/03/2020  17:50            28,672 db2systm
06/01/2019  12:31               528 db2tools.prf
20/03/2020  17:39    <DIR>          DIAG0000
13/11/2018  05:12            14,589 HealthRulesV82.reg
05/01/2019  22:15    <DIR>          hmonCache
05/01/2019  22:14    <DIR>          log
05/01/2019  22:14    <DIR>          security
05/01/2019  22:15    <DIR>          spmlog
05/01/2019  22:17    <DIR>          SQLDBDIR
05/01/2019  22:15    <DIR>          SQLNODIR
20/03/2020  17:50    <DIR>          TMP
05/01/2019  22:15    <DIR>          UIF
              12 File(s)         53,604 bytes
              13 Dir(s)  36,089,384,960 bytes free

I executed more to see the content of the db2nodes.cfg file

D:\ProgramData\IBM\DB2\DB2COPY1\DB2>more db2nodes.cfg
0 laptop1 laptop1 0

and indeed the values were different. So I opened the cfg file using notepad

D:\ProgramData\IBM\DB2\DB2COPY1\DB2>notepad db2nodes.cfg
0 laptop1 laptop1 0

and I replaced the value for the correct lenovot480

and saved and tried again.

D:\ProgramData\IBM\DB2\DB2COPY1\DB2>more db2nodes.cfg
0 Lenovot480 Lenovot480 0
D:\ProgramData\IBM\DB2\DB2COPY1\DB2>db2level
DB21085I  This instance or install (instance name, where applicable: "DB2")
uses "64" bits and DB2 code release "SQL11014" with level identifier
"0205010F".
Informational tokens are "DB2 v11.1.4040.491", "s1811091400",
"DYN1811091400WIN64", and Fix Pack "4".
Product is installed at "D:\PROGRA~1\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1".


D:\ProgramData\IBM\DB2\DB2COPY1\DB2>db2start
01/04/2021 10:55:13     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

This was such a misleading error message but glad I got it working again.

It’s not always what it looks like.