locked
"tcp:" in connection string? RRS feed

  • Question

  • As I've stumbled blindly from tutorial-to-tutorial-to-forum-to-forum-to-blog-and-back-again trying to dig out something that passes for documentation on all things Azure, I've run across numerous authoritative (i.e. apparently published by Micorsoft either on MSDN or the Azure website) examples that can't seem to agree on whether or not the "tcp:" gibberish is required in a connection string.

    My experimentation has been limited to just creating a simple MVC app in Visual Studio and publishing it to Azure.  I've determined, through experimentation, that my app works just fine both with and without "tcp:" and the port number in the connection string.

    This observation leads to a couple of questions:

    1. Am I correct in assuming that the "tcp:" stuff is only required if I want to connect to the Azure database from outside the Azure hosting experience?
    2. Is there a performance implication to using the apparently optional "tcp:" in the connection string of an app hosted by Azure?

    Bob


    • Edited by Bob.at.SBS Friday, August 24, 2012 3:49 PM corrected a typo
    Friday, August 24, 2012 3:48 PM

Answers

  • So, how does my Azure client know about the magic TCP port number if I don't specify it in the connection string?

    Port 1433 is the default port, but of course you should add it in the connection string like

    tcp:servername,1433


    Olaf Helper
    Blog Xing

    • Marked as answer by Bob.at.SBS Saturday, August 25, 2012 3:21 PM
    Saturday, August 25, 2012 5:18 AM

All replies

  • Hello,

    the prefix tcp: is nothing SQL Azure specific, ou can also use it for connections to on-premise SQL Server. It forces the SQL client to establish the connection via TCP/IP protocol. There is a little performance gain, because it avoid that the SQL client test connection via other protocols, like named pipes (which wouldn't work on internet connections).


    Olaf Helper
    Blog Xing

    Friday, August 24, 2012 4:10 PM
  • Thanks Olaf.  So, if I understand correctly, my Azure app ends up making a TCP connection to the database even if I don't specify it explicitly in the connection string.  So, how does my Azure client know about the magic TCP port number if I don't specify it in the connection string?
    Friday, August 24, 2012 7:59 PM
  • So, how does my Azure client know about the magic TCP port number if I don't specify it in the connection string?

    Port 1433 is the default port, but of course you should add it in the connection string like

    tcp:servername,1433


    Olaf Helper
    Blog Xing

    • Marked as answer by Bob.at.SBS Saturday, August 25, 2012 3:21 PM
    Saturday, August 25, 2012 5:18 AM