Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connection string to a SQL Server cluster

Could anyone point me or tell me how to write connection string to a SQL Server cluster instance?

I want to establish trusted connection to a database (initial catalog) of the specific instance of a SQL Server cluster. I find for quite some time but can not find official answer from Google.

I am asking for the connection string for C# ADO.Net code.

I know how to write connection string to a normal one-machine non-cluster SQL Server instance.

like image 683
George2 Avatar asked Apr 15 '09 13:04

George2


2 Answers

The connection string is written in the usual way; but in clustering you have 3 (or more) addresses: one for each node which constitues the cluster and one for the cluster. E.g.: we have two node with addresses 192.168.0.10 and 192.168.0.20: if you write down one of this numbers as the DataSource in the connection string, you'll gain access to that physical instance. But if you want to access the cluster (virtual) Sql Server instance, you'll have to use the cluster's address (e.g.: 192.168.0.230) as the DataSource. Of course, you can also use the machines' names instead of the IP addresses, provided you are in the same domain as the cluster.

like image 50
M.Turrini Avatar answered Nov 11 '22 17:11

M.Turrini


The server name is the virtual server name.

Example:

  • You have Physical pserver1, pserver2
  • These together make cluster cserver -This hosts virtual servers vserv1 (and perhaps, see below) vserv2

So, it's vserv1\instancename or vserv1. you don't use physical server names

Edit, based on number of possible names for virtual servers:

The cluster may be active/passive /A/P) or active/active (A/A)

  • In A/P, only one virtual server is hosted and the standby node is not actively used.
  • In A/A, there are 2 virtual servers and normally each node hosts one. Each node is standby for the other.
like image 42
gbn Avatar answered Nov 11 '22 18:11

gbn