Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force the TCP/IP protocol in connection string

I have a database driven website written in asp.net. I'd like to modify the connection string to force protocol TCP. Please advise.

<add name="TESTConnectionString" 
     connectionString="Data Source=SERVER201;Initial Catalog=DB201;Persist Security Info=True;User ID=201User;Password=123!@#"
     providerName="System.Data.SqlClient" />
like image 601
PW2 Avatar asked Dec 13 '10 15:12

PW2


People also ask

How do I force a TCP connection?

You can force a protocol by adding the protocol in front of Server Name, e.g. use "tcp:myserver" as Server Name to connect to. Use "sm" for shared Memory (only local Connections) and "np" for named pipe.

How do I enable TCP IP connection in SQL Configuration Manager?

Enable TCP/IP in the SQL ServerExpand the Configuration Tools subfolder and right-click on SQL Server Configuration Manager. Click on Run as Administrator. Select SQL Server Network Configuration and click Protocols for SMTKINGDOM. In the right pane, right-click TCP/IP and click Enable.

Does ODBC use TCP or UDP?

Solution: ODBC communicates with the SQL Server browser service using UDP port 1434 to detect the TCP port that SQL Server is using to communicate. ODBC then uses the detected port to communicate with SQL Server.


1 Answers

You can use server=tcp:hostname in your connection string to achieve this.

For more details, see How to use the server name parameter in a connection string to specify the client network library

like image 83
D'Arcy Rittich Avatar answered Sep 18 '22 18:09

D'Arcy Rittich