Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Alastair Sheppard <sheppaap AT lincoln.ac.nz>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] MS SQL Server - connecting to named instance withfreetds/DBD::Sybase?
  • Date: Mon, 11 Jul 2005 09:41:55 +1200

Hi,

Sorry for the blank email, slight hitch in what email address to send from.
Anyhow, what the message was meant to say:

I had this problem a while back, and the answer lies in how SQL server
handles instances. SQL server hosts each instance on a separate port on the
server. So, somehow find out what port number your particular instance is
listening on and use that as the $port variable below.

Ways to do that: Ask the sysadmin nicely or connect to that instance using
Enterprise manager and run netstat from the command line to find out what
port your using.

Hope that makes sense.

Cheers

Al

---
Alastair Sheppard
Email & Web Systems Administrator
Information Technology Services
Lincoln University
Canterbury, New Zealand
Email: sheppard AT lincoln.ac.nz
Phone: (64) (3) 325 2811 x 8996
Cellphone: 027 448 4020


>>> piraya AT online.no 8/07/2005 9:10:00 p.m. >>>
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
code:

#!/usr/bin/perl

use strict;

use DBI;
my $server = "101.64.2.5";
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
101.64.2.5, -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
http://lists.ibiblio.org/mailman/listinfo/freetds







  • Re: [freetds] MS SQL Server - connecting to named instance withfreetds/DBD::Sybase?, Alastair Sheppard, 07/10/2005

Archive powered by MHonArc 2.6.24.

Top of Page