views:

619

answers:

3

Hello everyone,

I am confused about the connection string format of ADO.Net when connect to a non-default instance of SQL Cluster. I did search but find various samples, could anyone let me know what is the correct format please (if I know the virtual server name and instance name)? I am using trusted connection.

thanks in advance, George

+1  A: 

ServerName\InstanceName ? Use double \ when handling strings in C#

smok1
I did not find any official documents covering the connection string format for SQL cluster non-default instance. Do you have any referred documents?
George2
I have passed MCTS on Sql Server, so I had to learn ;-), dont remeber exactly when I learned it. I thinh MSDN has some interesting section regarding sql server connnection strings, but I usually takes me some time to find it. Someone posted good reference to web site about connection strings here
smok1
Thanks all the same, appreciated if you could post your findings when you find samples for connection string format of SQL cluster non-default instance. I also searched in MSDN, but finding nothing.
George2
See http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspxand http://support.microsoft.com/kb/265808
smok1
@smok1, I want to confirm with you that for non-default instance, the connection string to SQL Cluster should be -- virtualservername\instancename, and connection string to default instance should be virtualservername.
George2
@George2: yes, this is how it should be.
smok1
Thanks for your confirmation, smok1!
George2
+3  A: 

See http://www.connectionstrings.com/ - great site for making DB connection strings.

Brandon Montgomery
No samples for connection string format for SQL cluster non-default instance. :-(
George2
+1  A: 

The following web site gives many different connection strings for you. The following should work I believe:

http://www.connectionstrings.com/sql-server-2005#1

This is also a duplicate of http://stackoverflow.com/questions/751634/connection-string-to-a-sql-server-cluster

samjudson
I did not find official answer from the links you provided. :-)
George2
To quote: "Use serverName\instanceName as Data Source"
samjudson
I want to confirm with you that for non-default instance, the connection string to SQL Cluster should be -- virtualservername\instancename, and connection string to default instance should be virtualservername?
George2
Can't you just try it and see if it works - surely that would be quicker than waiting for my reply. I connect to a machine on a cluster here with that format so it should work for you.
samjudson