Score:0

Unable to connect to local DB2 instance

bf flag

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] DB2INSTOWNER=LAPTOP-HBU9NEC4
[i] DB2PORTRANGE=20000:20005
[i] DB2INSTPROF=C:\PROGRAMDATA\IBM\DB2\DB2COPY1
[i] DB2COMM=TCPIP
[g] DB2_EXTSECURITY=YES
[g] DB2_COMMON_APP_DATA_PATH=C:\ProgramData
[g] DB2SYSTEM=LAPTOP-HBU9NEC4
[g] DB2PATH=C:\Program Files\IBM\SQLLIB
[g] DB2INSTDEF=DB2
[g] DB2ADMINSERVER=DB2DAS00

When I try to stop (and start) 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%
DB2

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

adamitj avatar
in flag
Db2 doesn't play nice in MS Windows if you already have another client runtime or another Db2 version installed. BTW, which version did you installed?
mao avatar
sl flag
mao
As long as you have a "currently supported" version of Db2-server installed on Windows-11, it will work just fine. Your question does not indicate the version, you should use the `db2level` command to give the complete version. Your errors happen because you need to run any db2 command in a special window that gets opened when you run the command `db2cwadmin.bat` (which opens an elevated cmd.exe type window in which you can use `db2` commands).
Score:0
in flag

Not sure if this will fix your problem without knowing the Db2 Version you installed neither if you already have other versions and editions of the Db2 database installed in the same workstation.

However, try to update the default Db2 instance, there's a program under Db2 application folder (old Start Menu folder). Then select the last version you installed (even if there is only 1 entry) and go Next Next Finish till the end.

(I don't have Windows here to test, but I know it is there).

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.