0

I want to use db2batch to measure the performance of single sql queries and I can't find any explanation on how to use db2batch without sql-file.

I tried: db2batch '[SQL QUERY]' -d [DATABASE_NAME]

but I don't get any response, except: ** All arguments before the first command line option are being ignored * Timestamp: Wed Jan 24 2018 15:33:36 CET

And it seems like something is calculating but I never get a response, even for the most simple queries (select * from table).

Can someone please help me? Thank you very much!

1 Answer 1

2

The command db2batch does not support a query parameter. All statements have to come from an input file. If nothing is specified it will read from standard input. You can use that to pipe in that single SQL query:

[henrik@bodensee] echo "select count(*) from syscat.tables;" | db2batch -d hltest
* Timestamp: Wed Jan 24 2018 15:48:25 CET
---------------------------------------------

* SQL Statement Number 1:

select count(*) from syscat.tables;

1          
-----------
        461

* 1 row(s) fetched, 1 row(s) output.

* Elapsed Time is:       0,005158 seconds

...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.