How to get the DB2 version installed in the machine whether it is 32 bit or 64 bit using batch file command in windows?
Asked
Active
Viewed 4,516 times
2 Answers
3
Try this inside the bat file:
@echo off
for /f "tokens=2 delims= " %%i in ('db2level ^| findstr "bits"') do echo %%i

Mark Barinstein
- 11,456
- 2
- 8
- 16
-
Mark- It's not working only "Instance" is getting printed on the command line. – Shiv Dec 06 '18 at 13:07
-
2Wha't the exact output of the following command on your server? `db2level` – Mark Barinstein Dec 06 '18 at 13:38
-
`db2level` command can't return just 'Instance' output. It's some very strange installation if so. – Mark Barinstein Dec 06 '18 at 14:20
-
1Thanks @Mark your code is working...only a thing we need to change is token from 2 to 5 as mentioned below------> for /f "tokens=5 delims= " %%i in ('db2level ^| findstr "bits"') do echo %%i.................acknowledge this as you see my comments – Shiv Dec 08 '18 at 18:45
2
On the server you run db2level
; when connecting remotely using db2 connect to yourdb
the server version and bitness will be printed on the console like so:
Database Connection Information
Database server = DB2/LINUXX8664 11.1.9.0
SQL authorization ID = YOURID
Local database alias = YOURDB

mustaccio
- 18,234
- 16
- 48
- 57
-
You didn't got me.... i want the result on windows batch file...and db2 software is installed on my machine... need batch file command for that – Shiv Dec 06 '18 at 12:19
-
My question is- How to get the DB2 version installed in the machine whether it is 32 bit or 64 bit using batch file command in windows? – Shiv Dec 06 '18 at 12:21
-
1Got my answer here is the code............ for /f "tokens=5 delims= " %%i in ('db2level ^| findstr "bits"') do echo %%i – Shiv Dec 08 '18 at 18:46