2

Following are the environment Details :

Database Server : SQL SERVER 2012 Operating System : Windows Server 2012

Single instance of SQL SERVER 2012 is installed in cluster configuration with 2 nodes. I have 3 IP addresses, one for each node of SQL SERVER and one for the cluster.

I am able to connect to this configuration by providing SQL SERVER instance name to the DataSource of connection string but i am unable to connect using cluster name as data source

so the following is working

<add name="Default" connectionString="Data source=SQLInstanceName;Initial Catalog=DatabaseNAme;User Id=userid;Password=password;Connection Timeout=120;" providerName="System.Data.SqlClient" />

but changing SQLInstanceName to IP address/Name of cluster does not work

<add name="Default" connectionString="Data source=clustername;Initial Catalog=DatabaseNAme;User Id=userid;Password=password;Connection Timeout=120;" providerName="System.Data.SqlClient" />

Is this by Design?

My understanding is that client application needs to connect to cluster and not to specific instance.

1
  • No, it's not by design; you should always be connecting using the virtual address -- that's the whole point of using a cluster, which is to abstract the specific piece of hardware running the instance. What error are you getting?
    – Jon Seigel
    Commented Mar 28, 2014 at 13:21

1 Answer 1

3

Neither of those should work. If it's a named instance, it should be:

DATA SOURCE=ClusterName\SQLInstanceName;

If it's a default instance, just:

DATA SOURCE=ClusterName;

You are always connecting to an instance of SQL Server, whether it is clustered or not. The cluster will know which node in the cluster is currently hosting the instance, and this should not really be a concern of yours, at least in terms of the connection string - that's kind of the whole point, a failover to a different node in the cluster should not require your application to change anything.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.