简体   繁体   中英

“Time” Command in Cygwin in Windows Command Line

I want to run a query using db2 in WINDOWS COMMAND LINE:

code:

db2 connect to sample;
db2 "Select * from TB1";

在此处输入图片说明

I am currently doing the IBM Lab activity in Data Concurrency and Locking and I want to determine and quantify the waiting time of the executed command using the "time command" in linux.

I have heard of the Cygwin and successfully installed it in my computer to execute UNIX/LINUX command. I test if "Time" Command can be successfully read by windows cmd using "bash"

在此处输入图片说明

I tried to execute this command to get the execution time of the query:

在此处输入图片说明

I also tried to include the connect to database

在此处输入图片说明

but still it keeps on saying

SQL1042N A database connection does not exist. SQLSTATE=08003

I am really new in DB2 and unfamiliar with Linux command... any help would bee greatly appreciated

Thank You

I could help you with "time" and DB2, but my recommendation is look into using the command db2batch . It is designed to benchmark, ie, get timing for SQL commands. There are various options for the output.

When using "time", do you know how the reported numbers need to be interpreted?

could you try this;

create script.sql in "C:\\Program Files\\IBM\\SQLLIB\\BIN\\" as below;

connect to sample;
Select * from TB1;

and then run this;

bash -c "time db2 -tvf script.sql"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM