0

I have two MSSQL instances: SERVERNAME1 and SERVERNAME2\SQL01 to which I try to connect from Linux machine using DBI:Sybase.

I have no problems to connect to SERVERNAME1, I use:

DBI->connect("dbi:Sybase:server=SERVERNAME.domain.com:PORT;database=master", "user", "pass")

and this works fine for me. The second server contains instance name also (SQL01)... So, my question is - How should I build connection string for SERVERNAME2\SQL01 ? I need to pass also domain.com and PORT within it.

Many thanks for help.

2
  • 1
    All the info is in the documentation - have you checked it out? Commented Sep 23, 2014 at 12:42
  • Yes, I checked it, but there is no info about how to connect with instance name... Commented Sep 23, 2014 at 13:27

2 Answers 2

1

Instance name is just a name for a port.
In some cases, you need to use port and not instance name

This is one such case.

A client makes a call to the SQL Server Browser on port 1434. This service resolves the port from the name. Not all clients know how to do this or may not be allowed too

The SQL Server names instance will need a static port assigned

Sign up to request clarification or add additional context in comments.

Comments

0

Each DB instance is mapped to a specific port on the server. As long as the DBA does change the mapping, you can either ask the DBA what port the database is served on or you can use this routine to find out what instance is mapped to what port. Just call the program with the IP address of the server. Edit your freetds.conf file based on the output of this program.

#!/usr/bin/perl
$|++;
use strict;
use IO::Socket::INET;
my $message = new IO::Socket::INET(Proto => "udp", PeerPort => 1434, PeerAddr => "$ARGV[0]", LocalPort => 1434,  Timeout => 10)
  or die "Can't make UDP socket: $@";
$message->send("\x02");
print "Sent message, waiting on response\n";
my ($datagram,$flags);
$message->recv($datagram,1024,$flags);
#print "Got message from ", $message->peerhost,", flags ",$flags || "none",": $datagram\n";
my @PARAMS=split(';',substr($datagram,3));
print "------------------\n Server $ARGV[0] reports:\n\n";
for(my $i=0;$i<($#PARAMS)+1;$i+=2) {
    if ($PARAMS[$i] eq "") {
       print "---------\n";
       $i--;
       next;
    };
    print "$PARAMS[$i]=$PARAMS[$i+1]\n";
};

-Rusty

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.