Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Naming one's hostname for sp_who
Date: Oct 9 2001 2:54PM
David LANDGREN writes:
> I have a number of old scripts kicking around on my server that I am loathe
> to touch, however, I would like to be able to distinguish which one is
> running when I do a sp_who.
> All the scripts connect with
> my $db = new Sybase::DBlib $user, $passwd, 'ouessant', 'db_app';
> i.e. the name of the server is 'ouessant' and that is what shows up in the
> hostname column of an sp_who. On the other hand, I have a number of even
> older shell scripts that bundle stuff up in calls to isql, but there you
> can use a -H switch to enter whatever you like as a hostname. I have edited
> these scripts to set the hostname to the name of the script. It works, and
> it makes the sp_who output useful.
> I am now trying to do the same for the scripts that use Sybase::DBlib, and
> I can't see any easy way of doing it (like a sethostname method?) Is this
Normally DB-Library sets the hostname by default, but it may not do so
on a Win32 platform (if that's what you are using).
There is a DBSETLHOST(loginrec, hostname) call, but Sybase::DBlib
doesn't implement it (or at least not yet).
You could add the hostname to the appname field (i.e. "db_app on
$host", or something like that).
Or add this to DBlib.xs and call before making a connection:
char * host
Put this around line 4540 of DBlib.xs (where you also have the
definitions of DBSETLCHARSET, etc), rebuild, and then call with
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
firstname.lastname@example.org - email@example.com
International Sybase User Group - http://www.isug.com