Search code examples
perlsybasekerberosdbi

Sybase-Perl DBLib mapping of fourth argument to DBI Connect


I am converting a perl script from DBlib to DBI for sybase connections. I am Implementing kerberos. what is the function of the fourth argument (the name of the perl script) in the DBLib connection and equivalent in DBI? eg. DBLib Connection:

$dbh     = new Sybase::DBlib $USER, $PASS, $SRV, "file.pl";

This is equal to -

$dsn = "dbi:sybase:server=$SRV;kerberos=$kerbprincipal;scriptName=file.pl";    
$dbh = DBI->connect($dsn,"","");

I found following about the DBI scriptName from cpan.org.

scriptName

Specify the name for this connection that will be displayed in sp_who (ie in the sysprocesses table in the program_name column).


Answer: The fourth argument in dblib and scriptName in dbi sets the program_name column in sysprocess table. this can be used in logs and monitoring the database.


Solution

  • I believe the AppName connection string attribute in MS SQL Server basically ends up in the sysprocesses table (and hence sp_who) and SQL Server started its life as Sybase. I think $appname in Sybase::DBlib is equivalent to ScriptName in DBD::Sybase. I cannot prove it now as I no longer have Sybase.