I have installed an Enterprise version of DB2 on my local Windows 11 pro laptop for some development tasks. Installation proceeded without errors but, it seems I cannot connect using TCP. If I try to stop/start from the admin console, it says I do not have set the environment variables even if I try to printout it works.

This is what I can see with db2set -all

C:\Windows\System32>db2set -all
[e] DB2PATH=C:\Program Files\IBM\SQLLIB
[i] DB2PORTRANGE=20000:20005
[g] DB2PATH=C:\Program Files\IBM\SQLLIB

When I try to stop the DB I get

C:\> db2stop
SQL1390C  The environment variable DB2INSTANCE is not defined or is invalid.

I tried to print the DB2INSTACE and I get this:

C:\>echo %DB2INSTANCE%

This is what I get if I try to create a sample DB

C:\>db2 create database TEST001
SQL1032N  No start database manager command was issued.  SQLSTATE=57019

Any clue? Thanks

  • 1
    One clue would be in the error message, which you chose not to disclose.
    – mustaccio
    Commented Apr 14, 2023 at 12:51
  • Well, you cannot connect to a database if the instance is not started. Make sure you are running the commands (what you want is db2start, not db2stop) from the DB2 Command Window.
    – mustaccio
    Commented Apr 14, 2023 at 15:47
  • With db2start I get same error message of db2stop (SQL1390C The environment variable DB2INSTANCE is not defined or is invalid.) Commented Apr 14, 2023 at 17:12
  • Do you run these commands from the db2cwadmin.bat with elevated privileges? What appears in the db2diag.log file? Commented Apr 14, 2023 at 19:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.