Ryan Abarquez Ryan Abarquez - 1 year ago 159
SQL Question

"Time" Command in Cygwin in Windows Command Line

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


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

enter image description here

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"

enter image description here

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

enter image description here

I also tried to include the connect to database

enter image description here

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

Answer Source

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"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download