While using DB2CLI command,we get IBM copyright information and footer details. Is there any option to suppress header and footer information ?
echo "select CURRENT USER from dual"|db2cli execsql -dsn 'SAMPLE'
Output
PS C:\Users\Desktop> echo "select CURRENT USER from dual"|db2cli execsql -dsn 'SAMPLE'
IBM DATABASE 2 Interactive CLI Sample Program
(C) COPYRIGHT International Business Machines Corp. 1993,1996
All Rights Reserved
Licensed Materials - Property of IBM
US Government Users Restricted Rights - Use, duplication or
disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
> select CURRENT USER from dual
FetchAll: Columns: 1
1
TESTUSER
FetchAll: 1 rows fetched.
>
Tried using set headers=off,which usually works in jsqsh but it doesn't work with DB2CLI,any leads are appreciated.
There is no documented way to do this with the db2cli tool for currently shipping Db2-LUW versions up to V11.5.
There may be undocumented methods that IBM staff/contractors may disclose.
The tool
db2cliis not intended as a general purpose SQL interface, instead it is for troubleshooting, verification, configuration, simple testing and also debugging.Alternatives include:
post-processing scripts to strip off anything you don't want, but you have to write these,
use a Db2-client that includes the
db2CLP which lets you use its-xoption (among other options) and does not issue a copyright string. The Db2 Runtime client is small footprint and includes thedb2CLP.use a scripting interface to Db2 (python, perl, bash) or a programmatic interface (c#, or other .net language) so you are in control, but these require relevant configuration.