[freetds] client pid

Frediano Ziglio freddyz77 at tin.it
Wed Apr 2 14:39:49 EST 2003


Il mer, 2003-04-02 alle 18:41, Lowden, James K ha scritto:
> > From: ZIGLIO Frediano [mailto:Frediano.Ziglio at vodafoneomnitel.it]
> > Sent: April 2, 2003 10:34 AM
> > 
> > I discovered how to know client pid from server (mssql2k)
> > 
> > select host_id()
> > 
> > Why host_id ??
> 
> Sybase consistently refers to the client machine as the "host".  I suppose
> they're looking at it from the application's point of view.  For example, in
> master..sysprocesses "hostprocess" and "hostname" refer to the client.  
> 
> What "pid" are you seeing, btw?  Surely not the same as reported by "ps" on
> the client?  It must be assigned by the server for its own purposes.  
> 
> My Win32 clients all have master..sysprocesses.hostprocess between 200 and
> 1600 as we speak.  My FreeTDS client's hostprocess (and host_id()) is
> -462205.  
> 

Take current version and use TDS 7+

$ ./src/apps/tsql -S**** -Usa  
locale is "en_US"
charset is "ISO-8859-1"
Password: 
Msg 5703, Level 0, State 1, Server ****, Line 0
Changed language setting to us_english.
1> select host_id()
2> go
	
8591    	
1> 

$ ps awx | grep tsql
 8591 pts/0    S      0:00 lt-tsql -S**** -Usa
 8606 pts/3    S      0:00 grep tsql

As you can see host_id() == pid of client!

(From Peter Daecon and Bill Thompson work)

freddy77




More information about the FreeTDS mailing list