[freetds] MS SQL Server - connecting to named instance withfreetds/DBD::Sybase?

Curt Kiser ckiser at wi.rr.com
Fri Jul 8 07:53:14 EDT 2005

If you are using a copy of SQL Server Personal Edition for your local copy
the TDS protocol version for personal is different than Standard/Enterprise.
You would need to compile FreeTDS using -with-tdsver=8.0. That should take
care of your incorrect login problem.

Thanks, Curt

 -----Original Message-----
From: 	freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org]  On Behalf Of Knut Brobakken
Sent:	Friday, July 08, 2005 4:10 AM
To:	freetds at lists.ibiblio.org
Subject:	[freetds] MS SQL Server - connecting to named instance

I'm currently struggling to find the correct way of using freetds and
Perl/DBD::Sybase to connect to a named instance of an SQL Server from Linux.

I have built, installed and tested freetds (v 0.63, TDS version 5.0 with MS
db-lib compatibility), and have successfully connected to and queried my
local SQL Server, both
using tsql and using DBD::Sybase from perl.

But the problem arises when I'm trying to connect to an external server that
has multiple instances of SQL Server installed.

My user only has access to one particular instance and database, and I get
"incorrect login" when I try connecting to the server using the following


    use strict;

    use DBI;
    my $server = "";
    my $port = "1433";
    my $db = "publish_prod";
    my $username = "pubusr_102";
    my $password = "VerySecret";

    my $dbh = DBI->connect("dbi:Sybase:$server:$port", $username,$password);

   $dbh->do("use $db");

I have also tried connecting using tsql from the command line with -H, -p 1433 and -U pubusr_102, and I get only "login failed for user
pubusr_102". I have connected to the server with Enterprise Manager on a
Windows box using these parameters, so I know that the username and password
are correct. I have also connected successfully to my local SQL Server using
the same syntax with tsql, so I know it is set up properly

It seems that I might need a way to provide the instance name of the SQL
Server and database when connecting.

What is the correct syntax for specifying the instance name and database in
the connect string from DBD?

And is there a way to provide the instance name to tsql to test this from
the command line?

Any help would be greatly appreciated.

Knut Brobakken
Chief Technical Officer

WebOn AS

http://www.webon.net <http://www.webon.net/>

mobil: +47 982 06 053 | direkte: +47 33 35 33 08 | fax: +47 33 35 33 01
Brygge Vest, Jarlsø, P.O. Box 2198, N-3103 Tønsberg

WebOn - for din lønnsomhet

FreeTDS mailing list
FreeTDS at lists.ibiblio.org

More information about the FreeTDS mailing list