Connection failure when trying to upload data to azure with bcp

Oct 5, 2010 at 8:49 AM


Debugging 3.3.8 I finally found out, why my Data uploads to azure fail when using SQLAzureMW.

Here's the explanation: When connecting to the target (=azure) SQL-Server I omit the @servername when entering my username because SQLAzureMW will ask me and add it itself.

When building the bcp arguments in TargetProcessor.BCPUploadData (Line 128) you get -U myusername (but without @servername) which won't work with bcp.

SQLState = 37000, NativeError = 40531
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Server name cannot be determined.  It must appear as the first segment of the server's dns name ( Some libraries do not send the server name, in which case the server name must be included as part of the user name (username@servername).  In addition, if both formats are used, the server names must match.

The reason for this is in ServerConnect.ConnectCommandButton_Click (Line 178). There you add @servername to the dialog's textbox but not to the _ServerConn.Login property!

This seems to work when connecting through Microsoft.SqlServer.Management.Common.ServerConnection but not on the commandline using bcp.exe which uses SQL Server Native Client.

I hope you got my point and can fix this for the next release?!

Oct 5, 2010 at 5:15 PM

Good catch.  It will be fixed in v3.3.9.


Oct 5, 2010 at 10:12 PM

Done.  Check out v3.3.9 and see if it works for you.

Thanks again for your feedback!

Oct 6, 2010 at 7:45 AM

Works perfectly now!

Thanks for the quick fix!


Nov 23, 2010 at 1:48 AM

I think you had a regession in 3.4 as I had to manually add my SQL Azure Database server name to my login to get it to work correctly.   if I didn't enter my name as {username}@{sqlazureservername} it would not work

Nov 24, 2010 at 5:09 PM

Hmmmm, I tried it without the @servername and I got the prompt and everything worked for me.  So, I don't know why it doesn't work for you.  Are you able to work as long as you provide the @servername?