SQL Server named instance remote connections without port - sql-server

I have a named instance of SQL Server Express that I want to make it visible on the network. I was able to do it, but other machines can only connect to it specifying the port number, even though it is the default port.
For example, other machines can connect to mine using (1433 is the default port for SQL Server):
<hostname>\<instancename>,1433
But other machines can't connect without using the port:
<hostname>\<instancename>
I checked the Firewall (other people can connect specifying the door), and SQL Server Browser is running (I don't fully understand but I read that it make some difference).
Any tips? Thanks.

If you're running on the default port try connecting to the host name without the instance name attached.

If you have named instances and don't want to declare your ports then you need to ensure that SQL Server Browser is running. go and check "sql server configuration manager"

Related

Connect to MS SQL Server 2014 from a computer on a different network

I have created an Application in VB.NET with database in MSSQL 2014.
I have configured TCP/IP=1433, UDP=1434, Windows Firewall is configured to allow 1433, 1434, sqlserver.exe, sqlbrowser.exe and server's login settings are configured. Application is working on my laptop which is on the same Internet connection as the host computer. I am trying to use the Application on client computer which is on another network and getting NAMED PIPES PROVIDER error40.
This is connection I am using:
Data Source=myServerName;InitialCatalog=dbName;UserId=clientcomputerName;Password=x
Do I need to configure client's computer in any way?
Does your DNS/HOSTS file resolve the remote computer name? Try IP address instead if not. Not sure but not all versions of SQL support remote connections via Named Pipes (can sometimes get round this by using registry hacks to add the connection as ODBC)

What happens when port number is not specified in SQL Server connection string?

I have two instances of SQL Server on my local machine. They both listen to separate ports. The first instance that I installed runs on the default port: 1433. I have set the other to listen to port 1434.
My application is using some old shared code that we have here to generate the connection string. So until now I didn't really know what was happening there. Due to a new requirement I found myself needing to examine the connection strings that I'm using to connect to the SQL Server.
What I found that was that for the connection string be built to connect to each of the SQL instances did not include Network Library, nor did they include the port number as part of the Data Source. The Data Source was just set to <Server Name>/<Instance Name>. I did find in the MS documentation that if the Network Library is not included then it is treated as (local), but it doesn't really explain how (local) is treated.
So my question is why is a connection string in this format able to connect to the SQL Server instance that runs on the non-default port? will this only work if the instances are on the local machine, or local network? Can I put <ip>/<sql instance> without the port if the server is remote?
I just need some clarity on how this works, and when is the port number needed and when it is optional as I'm trying to make my connection UI as simple as possible for our users.
There is such a thing called "SQL Server Browser Service":
http://technet.microsoft.com/en-us/library/ms181087(v=sql.105).aspx
It is intended to provide clients with information about sql server instances, ports. It actually listens on UDP port 1434.
With this service turned off you will still be able to connect to the instance, but you need to specify TCP/IP port.
I have two instances of SQL Server on my local machine. They both listen to separate ports. The first instance that I installed runs on the default port: 1433. I have set the other to listen to port 1434.
Just out of curiousity, why don't you just have them setup as named instances both running on the default of 1433 ?
As for why it works, if you search for SQL Configuration in your start menu, you'll find a screen similar to this.
Sql Server supports a number of different ways of connecting. TCP/IP is one way (ie IP addresses and ports) but it also supports a Shared Memory connection if you're on the local machine. that is, if you SQL Server executable, and management studio/client are also on the same machine.
At a guess I'd say it defaults to shared memory when you specify local and therefore you don't need to specify the port.
You could test this out by temporarily disabling shared memory in the above config, and see if your (local)\InstanceName stops working.

Connecting Named Instance in SQL Server

While connecting to a Remote SQL Server with two instance (Default, Named) I can easily connect to the default instance with the static IP but when its to Named Instance I can not connect through SSMS by putting "ServerName/InstanceName" rather then I can access by putting Port No like "ServerName,PortNo", but I want to connect with the InstanceName.
Things I have tried are :
Disabled firewall
SQL Browser is running
Check the protocols for the named instance in SQL Server Configuration Manager. Make sure TCP/IP and its IP addres(ses) are enabled.

SQL Server connect from another computer to my database

Hi all I installed SQL Server and from the localhost it works in my project however when I tried to access database from another computer It gives 0x80131904 exception. I couldn't find the reason what might be the solution?
Have you tried connecting by specifying the port number as well? Something like,
YourServerName,1433
YourServerName\YourInstanceName,1433
I have assumed it is on the default port. If not change 1433 with appropriate port number and try it.
Make sure your server is enabled for tcp/ip connections and that your computer does not block the SQL server port. Also make sure that you enable the proper authentication methods, ie SQL server auth, integrated, etc.

What port is my SQL2008 instance running on?

Check out this pic of my SQL 2008 Management Configuration screen for TCP:
I need to know what port I am running on. Based on this previous post, I don't believe that it is 1433, which I guess is the default.
When I check my port number in SQL Config Mgr., it is blank. Does this suggest a default port? Note that I have multiple SQL Server instances on the db server. One 2000 instance and two 2008 instances. I want to know the port of the 2008b instance.
The first display is for TCP. I'm not sure what VIA is, but check it out:
Can you help?
Update
I restarted my sql2008b instance and checked the log to look for a msg that indicated the port that it was using. It showed this:
2010-05-22 20:06:29.27 Server A self-generated certificate was successfully loaded for encryption.
2010-05-22 20:06:29.27 Server Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\SQL2008B ].
2010-05-22 20:06:29.27 Server Server local connection provider is ready to accept connection on [ \\.\pipe\MSSQL$SQL2008B\sql\query ].
2010-05-22 20:06:29.32 Server Server is listening on [ 127.0.0.1 <ipv4> 5786].
2010-05-22 20:06:29.32 Server Dedicated admin connection support was established for listening locally on port 5786.
Yet, when I tried to log on using the following as the server name:
(local)\sql2008b,5786
I still was unable to connect, while logged onto the remote box (hence using "local".)
A suggstion was made below to set the port myself. This occurred to me to try but there are a couple of things that are botehring me:
1) Why can I connect to my SQL 2000 instance without monkeying with anything to get it to work (but not my 2008 instance)?
2) The IP addresses shown in TCP1 and 2 don't appear correct. The one I blacnked out, presumably theIP address of my router and the one needed to make my server visible on the Internet, was not correct. Also , the local 192.168.1.100 was not correct. The db server server's IP adress end in a different number. perhaps I sh
TCP/IP is disabled in your screenshot so it isn't listening on any port. On start up when enabled it will write an entry to the SQL Server logs telling you what port it is listening to. (Accessible through Management Studio tree view Management -> Sql Server Logs nodes)
You might find this link useful How to configure an instance of SQL Server to listen on a specific TCP port or dynamic port
Also do you have the SQL Server Browser service running on that machine (it might help you connecting to the right instance)?
If TCP/IP is disabled, the service can still listen via Named Pipes (for network connections) or Shared Memory (for local connections), so it will work with TCP/IP disabled if you choose to got that route.
On startup, there will be an event log entry to tell you what connection methods it's listening for, or you can do a "NETSTAT -A" from the command line to see which ports the server is listening on in general.

Resources