How to test connection to MS SQL server running on Parallels on Mac OS? - sql-server

I am using visual studio for Mac and I have my sql server instance running on windows 10 using parallels. I enabled port 1433 in the inbound rules in the firewall and enabled the browser agent in my Sql config. as mentioned here. I am running my app using this connection string
"DefaultConnection": "Server=smb://10.211.55.4/WINDOWS10PRO;Database=aspnet-Testapp-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
but I am getting SqlException
SqlException: 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: SQL Network Interfaces, error: 25 - Connection string is
not valid)
How can I test my connection to the database using Mac OS ?

Related

SQL Server database engine remote connection

I have a PC with SQL Server installed.
I have created a VB.NET application to connect to SQL Server.
When I connect the SQL Server from development machine I can access the remote SQL Server database easily without any problem.
But from the client machine when I try to connect the same SQL Server I get an 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance specified)
Firewall is disabled
TCP/IP is enabled
Port 1433 is defined in the same way as on the development PC
I have tried with Ip: port and IP only to access the remote SQL Server database server.

netsh port proxy doesn't always work for SQL Server

I have a Mac running Windows 10 21H1 in Parallels. On macOS I have SQL Server running in a Docker container, exposed on port 55556.
In Windows I'm trying to forward localhost,55555 to the SQL Server in Docker.
For this I tried netsh interface portproxy add v4tov4 listenaddress=localhost listenport=55555 connectaddress=10.211.55.2 connectport=55556, but this only works when connecting in DataGrip (in the Windows VM, using a JDBC driver); I can see all the databases, query them, etc.
SQL Management studio always gives 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: TCP Provider, error: 0 - The wait operation timed out.) (Microsoft SQL Server, Error: 258)
Is there something about the driver that SQL Management studio uses that ignores this port forwarding?
I figured it out: portproxy with listen address localhost doesn't work, but 127.0.0.1 does.

Connect to SQL Server from another computer - SQL network-instance related issue (with error 258)

When I try to connect to SQL database from another computer using SQL Server Management Studio with Server Name [ my_ip_address,1433\MyServerName ] and SQL authentication, I get this error:
Cannot connect to XX.XXX.XXX.XXX,1433\MyServerName.
ADDITIONAL INFORMATION: 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: TCP Provider, error: 0 - The wait operation timed out.) (Microsoft SQL Server, Error: 258)
The wait operation timed out
I have done all of the needed steps:
Allowed remote connection in Server Properties window in SQL Management Studio
Enabled TCP/IP in SQL Configuration Manager (in SQL Server Network Configuration)
Set Inbound/Outbound enable connection (Domain, public, private) rules in Windows Firewall for ports
TCP 1433
This tuto solved the problem for me:
Allow SQL Server through Windows Firewall (
https://www.youtube.com/watch?v=3jVTUll4PXs)
I had to add the paths of the sql server and sql server browser services to the allowed apps by the firewall.

Connection String Works from Mac but not directly in Parallels

So I have a connection string from a .NET Core application attempting to connect to a database that is sat on a Parallels Windows VM. When I spin the app up using Visual Studio for Mac it can connect with no issues, I use the same connection string from the VM using Visual Studio from Windows and it won't connect to the database.
Here's the connection string:
Server=10.211.55.3,5171;Persist Security Info=True;User ID=sa;Password=<password>;Initial Catalog=Hub.Database;
The IP address it's connecting to there is the IP of Windows VM. Not sure why this would work in one place but not another.
Error message I'm getting is:
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: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified

How to connect to SQL Server from visual studio Mac?

I tried to connect to a remote SQL Server using visual studio Mac using this
"Server=PcName;Database=DatabaseName;user=eg;password=password;MultipleActiveResultSets=true"
but cannot connect this and this error appears from terminal in Mac:
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: TCP
Provider, error: 35 - An internal exception was caught)
Is this way correct? If not which is the right way?
Use Azure Data Studio, this is ssms for non windows machines.
Your connection is correct,Try restarting your sql server and agent...

Resources