I am trying to connect to MS SQL Server hosted on a network. Windows authentication and SQL Server mode is enabled (both). I cannot connect
[DBNETLIB]SQL Server does not exist or access denied.
[DBNETLIB]ConnectionOpen (Connect()).
Can anybody suggest how to provide the server name when there exists a domain and please be explicit with slashes if any.
Assuming your client is on the same network and all of the DNS records are working correctly (try pinging the server to see if it's available).
You could try connecting using the IP address
If you are trying to connect to a named instance use server\instance
Check that you are not being blocked by the Windows Firewall on either your machine or the server (at the very least port 1433 will need to be open for a default SQL instance)
make sure you enabled the following in Configuration Manager :
SQL Server Network Configuration
- Protocols
--- TCP/IP - Enabled
SQL Server Network Configuration (32bit and 64bit)
- TCP/IP - Enabled
- Name Pipes - Enabled
and make sure SQL Server Instance is logged on as a domain account for you to be able to execute network backup.
try opening sql thru SSMS if named instance use IP/name of instance
else just the IP
and log in as "sa"
Related
I have SQL Server Express installed on an Azure Windows Virtual Machine.
Steps I have taken:
updated the default port for SQL server in SQL Server Configuration Manager.
verified sql server is listening on that port (netstat -ano)
Added a Windows firewall rule to accept inbound traffic on that port (Scope of the rule limits to my static IP address)
added an inbound rule in Azure to allow access to that default port (Source IP address same as IP in Windows Firewall)
Verified Remote Connections are enabled in SSMS
Mixed authentication is enabled.
Verified user created is able to access the desired databases by logging in locally with Sql Server Management Studio. This is a sql server user and not a computer account
I am able to telnet and nc to the port.
The name of the SQL Server looks like this when i access it locally on the VM
localhost\SERVER_NAME or
hostname\SERVER_NAME
From a remote machine I am attempting to access this database using SSMS.
I have tried:
mydomain.com\SERVER_NAME -mydomain.com does resolve to the correct IP address
mydomain:1234\SERVER_NAME -1234 represents the default port that was set
I have verified the user name and password are correct. I have also tried turning off the Windows firewall which leads me to believe it might be the inbound rule in Azure but there's really nothing special to that rule, just allows traffic to the sql server port (1234, in this example).
What am i missing?
Can you please have a look to this article, if you did not yet, and ensure that you did all the steps required? To highlight a few important steps, please ensure:
Set the connectivity to publish
Use SQL Server Configuration Manager to manually enable the TCP/IP protocol
Use the SSMS to connect to your DB and use the following server address for your VM
Hope that it helps.
The correct connection string in SSMS is
mydomain,1234\SERVER_NAME
comma before port not colon.
I have a local installed SQL Server 2016 (Developer edition) installation on Windows 10 Pro. There is one named instance. I am a developer using MS SQL Management Studio and JetBrains DataGrip.
I just want my connections within my local machine to work with SQL Server over TCPIP using a SQL Server user account..! At the moment this only works using my Windows Authentication mapped to ServerAdmin
Named instance
RAXLENOVOT560\MSSQL2016MAIN
(authentication is mixed mode)
There are 3 issues that maybe linked:
TCP Port number does not appear to take effect within the Sql Server Configuration Manager.
The Sql Server Configuration Manager only shows limited properties on the Client Protocols/TCPIP settings. (please see screen shots)
Sql Server login user account does not connect via TCP due to an error. Login within local machine, local development from DataGrip to SQL Server.
1. TCP Port number
I have set this to 65321. However when I try and connect using this port no connection is made.
When I checked using the following SQL query I see the port number is actually 65514
SELECT DISTINCT
local_tcp_port
FROM sys.dm_exec_connections
WHERE local_tcp_port IS NOT NULL
results
local_tcp_port
--------------
65514
I change the port number in the config tool, restart ALL SQL Server services, reboot and still nothing works. Still listening on port 65514
Note I did not choose 65514, this seems to be a default from SQL Server.
2. The Sql Server Configuration Manager Properties Missing
Note the properties screen is limited only to a few options, there are usually lots more why is is? Perhaps due to running on Windows 10 Pro vs Windows Server?
3. Connection Login failure
Login from the local machine only.
I have opened the firewall for all the relevant SQL Server ports
TCP 1433
TCP 65514 (the forced sql server port)
TCP 65123 (what I would like to use)
UDP 1434 Sql Server Browser
I attempted login via a number of means
Sql Server Management Studio
Udl File
Java connection via DataGrip
Since opening the firewall, all the connections work but only if the hostname is 127.0.0.1, why can't I use the computer name? The connections also work if I use my Windows Login but NOT a SQL Server login
The login fails due to the error shown below from the SQL Server Log (which proves the TCPIP connection is reaching SQL Server).
Login-based server access validation failed with an infrastructure error. Login lacks connect endpoint permission
Date 24/04/2018 11:25:05
Log SQL Server (Current - 24/04/2018 11:20:00)
Source Logon
Message
Login failed for user 'SvrDeveloper'. Reason: Login-based server access validation failed with an infrastructure error. Login lacks connect endpoint permission. [CLIENT: 127.0.0.1]
The Sql Server User has the following permissions and settings (please see screenshot)
Name = SvrDeveloper
Server Roles = public
Securables = RAXLENOVOT560\MSSQL2016MAIN Type=Server
Securables = TSQL Default TCP Type=EndPoint
Connections
Udl Connection
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLNCLI11.1;Integrated Security=SSPI;Persist Security Info=True;User ID="SvrAdmin";Password="Password123";Initial Catalog="";Data Source=TCP:127.0.01\MSSQL2016MAIN,65514;Network Library=DBMSSOCN;Initial File Name="";Server SPN=""
Java connection:
jdbc:sqlserver://127.0.0.1:65514;databaseName=CcTools;user=SvrDeveloper; password=Password123
Some additional information:
Version
I dont have much experience with MsSql. I have no problem to connect to database by SQL management studio with SQL Server Authentication Mode on ip 127.0.0.1.
But my program fails to connect. I created file connect.UDL for test connection and got this error
[DBNETLIB][ConnetionOpen (Invalid Instance()).] Invalid connection
Some information may usefull
SQL server is on configured as Mixed Authentication Mode
DIsabled my firewall
Enabled all protocols (Shared Memory, Pipe names, TCP/IP, VIA)
Using 127.0.0.1 and 1433 port for TCP/IP protocol
Allowing remote connection on server
Can provide more information if you need. Thanks
EDIT : I deleted everything and installed SQL SERVER 2008 R2. Everything working now. Thanks all for your effort.
Ensure you have installed SQL Server as a "Default instance" in order to be able to connect with just the IP address or hostname. If it's a "Named instance" installation, you will need to specify the hostname and instance name to connect. (i.e. MY_HOST\MY_INSTANCE)
Check out the SQL Server Configuration Manager, and under SQL Server 2008 Services section, does the installation have the "Names instance" in brackets? - That's your named instance.
I have opened up port 1433 on my firewall, but every time I try and connect to my remote SQL Database with SQL Server Management Console I receive (Microsoft SQL Server, Error: 53)
https://social.technet.microsoft.com/wiki/contents/articles/2102.how-to-troubleshoot-connecting-to-the-sql-server-database-engine.aspx
http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx
Enable remote connections for SQL Server Express 2012
Short Answer
Check Firewall
Check Service is Running
Check TCP/IP is Enabled
Check SQL Server Properties "Allow Remote Connections"
Check if the SQL Server is on a restricted subnet
Then Run these if Those Do not Resolve
Right-click on TCP/IP and select Properties.
Verify that, under IP2, the IP Address is set to the computer's IP address on the local subnet.
Scroll down to IPAll.
Make sure that TCP Dynamic Ports is blank.
Make sure that TCP Port is set to 1433.
If you have a named instance then you must have the SQL Server Browser Service enabled
The browser service runs on port UDP 1434 and this must be allowed through your firewall
Hail Mary Pass if this is Still not Resolved
Go to the client machine, and run cliconfg.exe If named pipes is listed first, demote it, and promote TCP/IP.
check if the firewall is blocking the named pipes port, which usually is 445
What you need to do is go into SQL Server Configuration Manager where SQL Server is installed.
In the Start Menu, under the Microsoft SQL Server folder, open the Configuration Tools folder and select SQL Server Configuration Manager.
In the Config Manager, click the arrow next to SQL Server Network Configuration, then click on "Protocols for {Instance}". {Instance} will be your install, if it's the default instance it will be MSSQLSERVER.
On the right side, make sure that TCP/IP is "Enabled". Double click TCP/IP, in the window that opens, change the drop down to "Yes".
Here is the how to fix it and gain your connectivity back:
Click WindowsKey + R and enter services.msc
Once Services opens scroll down and locate service SQL Server
Highlight the service and click START
Wait for the service to start and retry to connect to your MSSQL instance
It should now work again and you will be able to connect to your MSSQL instance and run queries.
I have solved this problem. Please refer to this thread: http://social.technet.microsoft.com/Forums/forefront/en-US/d2624655-e6ff-4947-b1a8-a2edcffd8a21/denied-connection-netbios-session-protocol#68321990-4ac4-46fa-b7f8-9e0ded3234bb
In detail: I was receiving the following error from ISA when trying to connect from my SBS 2003 Server to my offsite MSSQL Database Provider via SQL Server Management Studio:
Denied Connection
Log type: Firewall service
Status: A packet generated on the local host was rejected because its source IP address is assigned to one network adapter and its destination IP address is reachable through another network adapter.
Rule:
Source: Local Host ( 192.168.1.1:29859)
Destination: External (...:139)
Protocol: NetBios Session
I have figured this out. I had to add "Local Host" as one of the sources for the ISA Rule that I had initially created to allow SQL Server Management Console connections in the first place. That rule was allowing "Internal" sources but not the Local Host (127.0.01), which is needed for this scenario.
in SSMS while opening give the server name as your_Hostname\your_sqlservername (give both the names as applicable instead of local or just only servername) it works fine.
I could ping my Virtual Machine SQL server but couldn't connect to it.
I disabled my wired and wireless NICs and then it connected !
Initial Attempt
I have an Azure VM with Windows Server 2012, on which I just installed SQL Server 2012 Express Database Engine component. Then, I followed the instructions here to connect remotely with SQL Server Management Studio.
Create a TCP endpoint for the virtual machine
Open TCP ports in the Windows firewall
Configure SQL Server to listen on the TCP protocol
Configure SQL Server for mixed mode authentication
Create SQL Server authentication logins
Determine the DNS name of the virtual machine
Connect to the Database Engine from another computer
After step seven I received the following error:
A network related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Microsoft SQL Server, Error: 53)
What else do I need to configure before connecting remotely?
Troubleshooting
I have been following the troubleshooting instructions here. Each blockquote below is a step described that that link.
Confirm the instance of the SQL Server Database Engine is installed
and running.
Done. We installed SQL Server Express, and it is running as a named instance called SQLEXPRESS.
If you are attempting to connect to a named instance, make sure the
SQL Server Browser service is running.
Done. We followed the steps here to turn on the SQL Server Browser service.
Get the IP Address of the computer.
Done. We will use these later for testing connectivity and maybe for setting up a static port for SQLEXPRESS.
10.241.62.155
fe80::45c:8c29:e19f:f78b%15
Get the TCP port number used by SQL Server.
Done. The SQL Server Management Studio server logs showed that the server was listening on port 49169.
Enable Protocols
Done. We had already enabled TCP/IP in the configuration manager, but we restarted the SQL Server Service just in case.
Testing TCP/IP Connectivity
Done. We used tcping.exe to test connectivity (cmd ping doesn't work quickly with Azure.) We were able to connect to port 80.
tcping.exe buddha.cloudapp.net > successful
tcping.exe buddha.cloudapp.net 80 > successful
Testing a Local Connection
Done. We used sqlcmd.exe from the command prompt and were able to connect locally via TCP with a username and password.
sqlcmd -S Buddha\SQLEXPRESS (success via shared memory protocol)
sqlcmd -S tcp:Buddha\SQLEXPRESS (success via TCP)
sqlcmd -S tcp:Buddha\SQLEXPRESS -U sa -P (success via TCP with username)
sqlcmd -S tcp:10.241.62.155\SQLEXPRESS -U sa -P (success with internal IP)
Opening a Port in the Firewall
We opened the port on which we SQLEXPRESS listens. The server logs (above) showed that SQLEXPRESS was listening on port 49169, but this is just one of many dynamic ports, and we wanted to set up the static port 1435.
Use WF.msc to create an inbound TCP rule for port 1435.
Use Azure Management Portal to create a TCP endpoint for port 1435.
The troubleshooting instructions also say:
If you are connecting to a named instance or a port other than TCP
port 1433, you must also open the UDP port 1434 for the SQL Server
Browser service.
Since we are connecting SQLEXPRESS (a named instance), we needed to open port 1434 for UDP.
Use WF.msc to create an inbound UCP rule for port 1434.
Use Azure Management Portal to create a UDP endpoint for port 1434
Further research about connecting to named instances revealed dynamic port issues. The reason why we are using port 1435 (static) instead of port 49169 (one of many effective options.)
Instances of SQL Server Express, SQL Server Compact, and named
instances of the Database Engine use dynamic ports. To configure these
instances to use a specific port, see Configure a Server to Listen on
a Specific TCP Port (SQL Server Configuration Manager). and
here.
Done. We went to SQL Configuration Manager > SQL Server Network Configuration > Protocols for SQLEXPRESS > TCP/IP, we did the following.
Protocol Tab > Listen All > NO.
IP Addresses Tab > for each listed address
Enabled > Yes
TCP Dynamic Ports > Blank (delete the zero)
TCP Port > 1435 (or your choice)
After restarting the SQLEXPRESS service, we again looked in the SQL Server Management Studio logs, and found that the Server is Listening on port 1435!!! Hooray!
Testing the Connection
Done. We opened SQL Server Management Studio on our local (non-Azure) computer and connected.
buddha.cloudapp.net,1435 OR buddha.cloudapp.net\SQLEXPRESS
sa
password
Success.
Here are the three web pages on which we found the answer. The most difficult part was setting up static ports for SQLEXPRESS.
Provisioning a SQL Server Virtual Machine on Windows Azure. These initial instructions provided 25% of the answer.
How to Troubleshoot Connecting to the SQL Server Database Engine. Reading this carefully provided another 50% of the answer.
How to configure SQL server to listen on different ports on different IP addresses?. This enabled setting up static ports for named instances (eg SQLEXPRESS.) It took us the final 25% of the way to the answer.
The fact that you're getting an error from the Names Pipes Provider tells us that you're not using the TCP/IP protocol when you're trying to establish the connection. Try adding the "tcp" prefix and specifying the port number:
tcp:name.cloudapp.net,1433
I too struggled with something similar. My guess is your actual problem is connecting to a SQL Express instance running on a different machine. The steps to do this can be summarized as follows:
Ensure SQL Express is configured for SQL Authentication as well as Windows Authentication (the default). You do this via SQL Server Management Studio (SSMS) Server Properties/Security
In SSMS create a new login called "sqlUser", say, with a suitable password, "sql", say. Ensure this new login is set for SQL Authentication, not Windows Authentication. SSMS Server Security/Logins/Properties/General. Also ensure "Enforce password policy" is unchecked
Under Properties/Server Roles ensure this new user has the "sysadmin" role
In SQL Server Configuration Manager SSCM (search for SQLServerManagerxx.msc file in Windows\SysWOW64 if you can't find SSCM) under SQL Server Network Configuration/Protocols for SQLExpress make sure TCP/IP is enabled. You can disable Named Pipes if you want
Right-click protocol TCP/IP and on the IPAddresses tab, ensure every one of the IP addresses is set to Enabled Yes, and TCP Port 1433 (this is the default port for SQL Server)
In Windows Firewall (WF.msc) create two new Inbound Rules - one for SQL Server and another for SQL Browser Service. For SQL Server you need to open TCP Port 1433 (if you are using the default port for SQL Server) and very importantly for the SQL Browser Service you need to open UDP Port 1434. Name these two rules suitably in your firewall
Stop and restart the SQL Server Service using either SSCM or the Services.msc snap-in
In the Services.msc snap-in make sure SQL Browser Service Startup Type is Automatic and then start this service
At this point you should be able to connect remotely, using SQL Authentication, user "sqlUser" password "sql" to the SQL Express instance configured as above. A final tip and easy way to check this out is to create an empty text file with the .UDL extension, say "Test.UDL" on your desktop. Double-clicking to edit this file invokes the Microsoft Data Link Properties dialog with which you can quickly test your remote SQL connection