0

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

5 Answers 5

3

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

1
  • No samples for connection string format for SQL cluster non-default instance. :-(
    – George2
    May 20, 2009 at 12:33
2

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

7
  • 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
    May 20, 2009 at 12:29
  • 1
    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
    May 20, 2009 at 12:32
  • 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
    May 20, 2009 at 12:36
  • 2
  • 1
    @George2: yes, this is how it should be.
    – smok1
    May 21, 2009 at 8:20
1

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 connection string to a SQL Server cluster

4
  • I did not find official answer from the links you provided. :-)
    – George2
    May 20, 2009 at 12:37
  • To quote: "Use serverName\instanceName as Data Source"
    – samjudson
    May 20, 2009 at 13:17
  • 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
    May 21, 2009 at 16:44
  • 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
    May 22, 2009 at 8:04
0

If you can connect to it using visual studio the connection properties should give you the connectionstring vs.net uses. Using that connectionstring might help.

0

If you want a quick & easy way to try different connection strings, I suggest DatabaseTester (disclaimer - I wrote it). It's free and a very easy way to test. And I agree with the other posts above, for figuring out connections strings ConnectionStrings.com is your best friend.

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.