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 > Other > the information about a connection in progress

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-18-04, 03:41
cschang cschang is offline
Registered User
 
Join Date: Mar 2004
Posts: 1
the information about a connection in progress

Is there any function that can get the information of a connection in progress? such as pid, tty .. etc.
Reply With Quote
  #2 (permalink)  
Old 05-18-04, 09:02
JODonnell JODonnell is offline
Registered User
 
Join Date: Feb 2004
Location: Pittsburgh, PA
Posts: 41
Quote:
Originally Posted by cschang
Is there any function that can get the information of a connection in progress? such as pid, tty .. etc.
What platform? And which database?
Reply With Quote
  #3 (permalink)  
Old 05-18-04, 09:38
brbogdan brbogdan is offline
Registered User
 
Join Date: Nov 2003
Location: Lomza, POLAND
Posts: 81
Here you are the simple procedure, which shows all connections and locks applied by them:

/* connusr.p */
/* BogdanB - procedure displays list of processes
actually connected to db */

def var tableName as char no-undo.

for each _Connect
no-lock /*,
each _User
where _User._Userid = _Connect._Connect-Name
no-lock */ :

if _Connect._Connect-Usr = ? then
next.

display
_Connect._Connect-Id
_Connect._Connect-Usr
_Connect._Connect-Type
_Connect._Connect-Name
_Connect._Connect-Pid
with centered .

for each _Lock
no-lock
on error undo, leave
on stop undo, leave:
if _Lock._Lock-Usr = ? then
leave.
if _Lock._Lock-Usr <> _Connect._Connect-Usr then
next.

find _File
where _File._File-Number = _Lock._Lock-Table
no-lock no-error.
if not avail(_File) then
tableName = "ERROR: no table!".
else
tableName = _File._File-Name.

display
_Lock._Lock-Type
tableName format "X(32)"
_Lock._Lock-RecId
_Lock._Lock-Flags
with centered .
end.
end.
pause.
quit.

Hope it helps.
Bogdan
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