Re: Connecting to Sql Server using an IP address



Hello David,

Your situation reminded me about another similar case: Under network
protocol TCP/IP, using IP address without port number (default port number
of SQL Server is 1433) cannot connect to the SQL Server on a remote
machine, using server name does not work either; under network protocol
named pipes, both using IP address without port number and using server
name in the connection string can connect the remote machine successfully.


The root cause of that case is the port number of SQL Server when
connecting under the network protocol TCP/IP. If the port has been
changed to other port numbers, we need to modify the connection string when
using IP address to connect to the SQL Server and add set the network
protocol as TCP/IP. The connection string can be "Data
Source=*.*.*.*,1500(the new port number);Network
Library=DBMSSOCN(TCP/IP)?". For detail, please see
http://www.connectionstrings.com/sql-server-2005 and
http://www.connectionstrings.com/Articles/Show/define-sql-server-network-pro
tocol.

Therefore, I recommend you start from checking the TCP/IP port setting to
troubleshoot this issue. Please refer to this article to check the port
setting in the SQL Server:
http://msdn.microsoft.com/en-us/library/ms177440(SQL.90).aspx.

If the problem is not caused by TCP/IP port settings, you can also follow
this KB article to check whether the remote SQL Server has been set
correctly to accept remote connections,
http://support.microsoft.com/kb/914277.

For your second question on how the native SQL Server ADO.NET connection,
ODBC ADO.NET connection and OLEDB ADO.NET connection accept the IP address,
please see the following analysis:
//////////////////////////////////////////////////////////////

Native SQL Server ADO.NET Connection:
Could you please clarify what do you mean by native SQL Server ADO.NET
conection?

//////////////////////////////////////////////////////////////

ODBC ADO.NET Connection:
For SQL Server:
You can use such an ODBC connection string to connect the database:
"Driver={SQL Server}; Server=***.***.***.***(IP address),****(port number);
Database=DatabaseName; Uid=***; Pwd=***".

For IBM DB2:
Here are the keywords in the connection string:
Keyword "NTL=TCPIP" for TCP/IP connection
Keyword "NA" for IP address and "NP" for network port
For detail, please see
http://msdn.microsoft.com/en-us/library/ms944772.aspx.

To connect other database software via ODBC connection string, you need to
consult corresponding vendor company.

//////////////////////////////////////////////////////////////

OLEDB ADO.NET Connection:
For SQL Server:
You can use such an OLEDB connection string to connect the database:
"Provider=SQLOLEDB;Data Source=***.***.***.***(IP address),****(port
number);Initial Catalog=DatabaseName;User ID=***;Password=***".

For IBM DB2:
Here are the keywords in the connection string:
Keyword "Network Transport Library=TCPIP" for TCP/IP connection
Keyword "Network Address=***.***.***.***" for IP address
For detail, please see http://www.connectionstrings.com/ibm-db2.

To connect other database software via OLEDB connection string, you need to
consult corresponding vendor company.

//////////////////////////////////////////////////////////////

For the third question about other vendors' connection string, please
understand that is not supported in Microsoft Newsgroup Supporting service.
You may consult the corresponding vendor company for the answer.

If you have any other questions, please be free to let me know. Have a
nice day, David!


Regards,
Lingzhi Sun (v-micsun@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • Re: Connecting to DB with Static IP over the internet
    ... port and dmz was forward to the incorect internal ip address:) ... and any other ms sql server related ports on the server. ... item on the connection string. ... is listening, I do netstat -a and it does list that it is being listened ...
    (microsoft.public.sqlserver.setup)
  • RE: Connecting remotely through VPN
    ... Configuration manager shows that it is using dynamic port 1107. ... SQL Server Express instance. ... Microsoft Online Community Support ...
    (microsoft.public.sqlserver.connect)
  • RE: SQL server does not allow remote connections error
    ... Server 2005 however another web application could connect to the SQL Server ... use the alias in your connection string to connect to your SQL Server. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.connect)
  • Re: Installing Sql Server Express on Vista Home Premium
    ... It seems that your SQL Server instances are Named Instances, ... Default Instances uses 1433 TCP port by default as a Static Port but not the ... If you change your Connection String as following, ...
    (microsoft.public.sqlserver.setup)
  • Re: connect to named instance w/ non-default port
    ... it sounds like there is no need to specify the port number in the connection string. ... It listens on port 1434 for SQL Server requests by name/instance and resolves them to the particular port. ... this is well and good because I am troubleshooting a network where the Sql Server instance is reassigned a new listening port on machine restart. ...
    (microsoft.public.sqlserver.connect)