If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Ugly bypass, is there a better solution?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-09, 09:18
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Question Ugly bypass, is there a better solution?

On linux, one can type:
Code:
time db2 "connect to sample"
time db2 "select * from employee"
On MSwin I recently found "timethis.exe" which does the same. But when I try the same sequence on windows it seems that the db2 connection can not be used in the "timethis" shell.

I found an ugly bypass, which I only use on my test-servers:
Code:
db2set db2dbdft=sample
This is an option I do not like to use or propagate.. is there a better way to solve my problem?
Reply With Quote
  #2 (permalink)  
Old 01-20-09, 09:46
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I assume you want to see the timings of the statements you are trying to execute. Try doing something like this:

1) place all the statements into a file.
2) insert a select statement that gets the current time between each statement.
3) save the file
4) execute the script using db2 -tvsf <filename> (use the appropriate options depending on your script).

The script file would look like this:
-------------------------
connect to sample;
select current timestamp from sysibm.sysdummy1;
select * from employee;
select current timestamp from sysibm.sysdummy1;
-------------------

Andy
Reply With Quote
  #3 (permalink)  
Old 01-21-09, 05:35
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Thanks, but I was more looking for a way to let DB2 "enherit" the connection in a child process. This works on linux and, if I recall well, it used to work on windows while on DB2 V8.
Something changed in V9, it does not behave the same. And the "db2dbdft" approch should be avoided don't you think?
Reply With Quote
  #4 (permalink)  
Old 01-21-09, 06:50
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
db2dbdft :This variable specifies the database alias name of the database to be used for implicit connects. If an application has no database connection but SQL or XQuery statements are issued, an implicit connect will be made if the DB2DBDFT environment variable has been defined with a default database.
what is meant by : DB2 "enherit" the connection in a child proces
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 01-21-09, 09:17
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by przytula_guy
what is meant by : DB2 "enherit" the connection in a child proces
From db2cmd on ms-win:
when you type:
Code:
 
timethis db2 connect to sample
db2 connect
then the 2nd will indicate that no connection exists. This makes sence because the the program "timethis" owned the connection and is finished now

But when you type:
Code:
 
db2 connect to sample
timethis db2 connect
db2 connect
you will see that the 2nd command will have no connection, and the 3rd does have one. I would expect/desire that the 2nd command would enherit the connection from it's root (db2cmd).

Is there someone on DB2 V8 on windows to confirm that this does work?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On