2

I have a Windows Server 2012 named "XYZ" and an SQL server instance named "XYZ". If I connect via Server=XYZ; it seems to work fine. On the other hand, if I try to connect via Data Source= I am simply unable to come up with the proper string...I've tried:

.\XZY
(local)
XZY\XYZ
(local)\XYZ
XYZ
etc.

For reference, the full connection string I used:

Data source=????; Initial Catalog=DatabaseName; user id=***;password=***; Integrated Security=false; MultipleActiveResultSets=true

Is there possibly a reason why Data Source= would not be working at all perhaps? Do I need to install or change some setting to get it to work?

6
  • Why would you setup the SQL Instance to match that of the server, the proper config would then be to use the default instance. Jan 4, 2013 at 16:46
  • It is actually the default setup provided by Azure Virtual Machine. I did not change it as I see no need to. Assuming I connect to the default instance, then (local) or some variation of that should work, no? But it does not. Only if I connect via Server=.
    – Aron
    Jan 4, 2013 at 17:18
  • Sorry if the question is dumb, I have never needed to use Data Source so it may very well be something obvious. But typical google searches revealed the options above, and those I have exhausted...
    – Aron
    Jan 4, 2013 at 17:20
  • Make sure you include details such as where/how the DBs are hosted in the future, the bit about Azure changes things a lot. Jan 4, 2013 at 17:38
  • The default instance isn't a named instance. If you're connecting to the default instance then no instance name is needed in your connection string, only the server name is needed.
    – joeqwerty
    Jan 4, 2013 at 19:49

1 Answer 1

0

It looks like you are trying to use a standard .NET connection string. You can get specific Azure connection strings here.

I think the issue you are having is that you have not specified the provider to use in your string. If you are using OLE you need to tell it so, otherwise you need to reference the standard .NET SQL Drivers. You have to be very specific with the connection string in Azure.

Here's an example:

Provider=SQLNCLI11;Password=myPassword;User ID=[username]@[servername];Initial Catalog=databasename;Data Source=tcp:[servername].database.windows.net;

EDIT: In this case the solution was mentioned in the comments - the SQL Browser Service was not running and so it could not locate the named instance.

4
  • Just to clarify, the virtual server is running on Azure, but the SQL instance is actually a local SQL Server 2012 instance running on the server itself, not Azure SQL.
    – Aron
    Jan 4, 2013 at 17:41
  • 1
    If that's the case are you running the SQL Browser service on the VM? Named instances cannot be located unless the browser is running. Jan 4, 2013 at 17:42
  • It seems running the SQL Browser service solved it! Thanks!
    – Aron
    Jan 4, 2013 at 21:36
  • Yeah, was just doing that :). I've added the solution to the message body so it's not just hidden in the comments...
    – Aron
    Jan 5, 2013 at 16:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .