Connecting to SQL Server running on Parallels on Mac - sql-server

I am running MAC with parallels installed. I have windows 7 Pro installed on Parallels, and SQLServer Express 2012 installed on Windows 7.
I am trying to connect to the SQL Server database from the Mac OS, but not having any luck.
I followed this post here, but still unable to connect. So I am thinking it may have to do with it running in a VM?
I'm receiving the following error when attempting to connect:
ERROR: An error occurred while trying to make a connection to
the database:
JDBC URL: jdbc:jtds:sqlserver://10.211.55.4:1433;appName=RazorSQL;ssl=request;useCursors=true
Login
timed
out.
I am able to ping the IP address.
Has anyone set this up? Any tricks or pointers you can suggest?
Many thanks in advance

It turned out to be the firewall on Windows 7. Once I created a rule to allow traffic through on Port 1433, I was able to connect fine.
This was done by
opening "Windows Firewall with Advance Security".
Selecting "Inbound Rules" > "New Rule".
Selecting "Port" as the rule type, then entering 1433 as the port number to allow.

You have to change the default behavior of Parallels to use NAT, and use a dedicated IP (in the 10.x.x.x range to avoid IP collision with your own network!), then connect to this IP.

Related

SSMS - Microsoft SQL Server Management Studio 18 do not discover SQL Express network servers

I've 4 SQL Express servers on my network, and I'm able to connect to all of them with SSMS from the different computers across the network.
But I'm not able to see them in the SSMS "Browse for Servers" window if i'm doing a search (Browse for network servers).
I've tried to disable all firewalls, made firewall rules for TCP port 135, 1433, 1434 and 4022 and UDP port 1434 allowed for both in and out.
And servers has been set up for listening on port 1433. And the "SQL Server Browser" is running.
It is working with connection, but not able to browse them.
Does anyone know why, and if there is a fix for this?
I've solved my problem, it was caused by VMware workstation on the computers. I found out about this, by using the CMD "C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe" -c like mentioned in this thread.
By stopping the "SQL Server Browser" Service, and start it from the CMD you get to see what happens in the service, And it was not as I expected. It seems like that the virtual network adapters from VMware was causing the problem, because it looking like the SQL server browser was using the wrong adapters.
It might be because I've installed the VMware workstation before the SQL server. But anyway by removing the adapters and using only a bridged connection from the VMware for now, everything is working as expected.

Correct Firewall Exception for Named Pipes (SQL Server)

I am trying to debug aspx.net and c# code. An sql connection to a remote SQL server default instance should be opened.
The connection works fine if the windows firewall on the sql server host is down.
If the windows firewall is up I get an error:
named Pipes Provider Error 40 cannot open connection to Sql server instance
The dev machine is windows 10 with visual studio.
The machine with the ms sql server instance is a vm with windows 2012 with sql server 2012.
In that machine I get an error in the windows security events claiming that the user name or password is incorrect. This error is a bit strange since the user name and password must be correct (otherwise it would not work if the firewall was down)
I have already checked the sql server configuration manager TCP/IP and named pipes are enabled.
In the firewall I already set an exception allowing a TCP connection to port 1433.
In the sql server configuration manager - SQL Server network configuration - TCP/IP the listed port is 1433. So I cannot find my mistake in the firewall config. What am I missing?
Found the solution:
The firewall rule to allow port 1433 had to be extended. Even though switching off the private firewall made the access work did not mean that the firewall rule allowing access only in the private profile would be enough. Making the port 1433 available for all profiles (private, public, domain) solved the problem.
Thanks to Christian. Even though port 445 is not needed in my case your comment was still helpful. I tried it and it did not work. So key was to find out which port is the blocking one.
This can be done with a simple netstat command. Performing netstat first when the connection is down and then netstat when the connection is up is a very simple way to find out which port must be openend.

How to connect to an SQL Server on Parallels VM

I'm attempting to connect to a test Database on a Parallels VM on Mac using Azure Data Studio, but I'm getting the standard, generic connection error:
System.Data.SqlClient.SqlException (0x80131904): 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: 40 - Could
not open a connection to SQL Server)
Steps I've taken so far to open the connection include:
Opening port 1433 through windows firewall
Ensuring remote connections are allowed on the SQL instance
Setting the TCP/IP Protocol to 5171 for IPAll
Running SQL Server and SQL Browser Instances
Adding a rule to windows firewall for sqlservr.exe to allow all connections
Enabling the SA account and adding a password (password is correct - I've double checked in SSMS on the VM)
I'm able to connect from the windows VM but not the Mac.
My connection string is below (IP is correct, again I've double checked):
Is there a step I've missed or some extra config that I need to do on the VM itself maybe? Or maybe the connection string isn't quite right? I've also tried using the Machine Alias to connect to the instance (SQLEXPRESS) - but still no joy. Anyone know what the problem might be because it's driving me crazy and I can see that other devs have made it work, so I know it's possible. My version of Parallels is Desktop 15, I don't know if that makes a difference or not?
Ok so turns out I needed to open the IPAll port I had set for the TCP/IP Config which in my case was 5171 as well as adding a rule to allow SQL Server Browser to connect to the internet.
For those of whom the above method doesn't work, try Bridged Network instead of Shared Networking in the Network settings and replace the old IP address with the new one.
I am able to connect to Microsoft SQL Server (in Parallels Desktop 16) using Visual Studio Code in macOS Big Sur.

How to Enable TCP/IP for mssql instance in ubuntu 16.04?

I'm not able to connect SQL Server hosted in Ubuntu 16.04 using my program, I believe its because the TCP/IP is disabled for the instance I try to connect (Protocols for SQLEXPRESS under SQL Server network configuration).
How I'm sure because I tried to connect my program to SQL Server that hosted in Windows and it able to connect.
Example my instance name is SQLEXPRESS, so I'm trying to connect through SSMS by using IP Adress\SQLEXPRESS and it fails. But I am able to connect to the SQL if I use IP address only as the server name.
I tried to search about sqlcmd for enable the tcp/ip but all of them just show the guide to change the ports.
So, how can I enable tcp/ip connection for ip\SQLEXPRESS instance in Ubuntu 16.04?
picture below just an example on enabling tcp/ip for the sql instance in windows
I believe the reason why this doesn't work on linux is because it doesn't have a SQL Server Browser application that Windows has available. This application redirects the requests to 1433 to whatever random port it's listening to currently -- this is why it will only connect when the port is specified. In my case this stinks because I'm having to work around an ancient application that we don't have the source code for. I'm thinking about writing a little application that will redirect the default traffic to the correct port for linux msssql.

SQL Server 2008 suddenly stopped connecting

This one is strange...
I have a server at home that's part of my home network (workgroup). It has SQL Server 2008 R2 SP1 running on it. I've been connecting to it from my (other) desktop regularly for months now and tonight all of a sudden I can't connect to it from my desktop. I can connect to it if I RDP onto the server and connect locally. I've checked the event logs on the server and nothing interesting appears.
Here's the (unhelpful) error returned by Management Studio from my desktop when trying to connect to the server:
Timeout expired. The timeout period elapsed prior to completion of
the operation or the server is not responding. (.Net SqlClient Data
Provider)
I'm kinda stumped by this really. I've tried connecting with sqlcmd - it tells me this:
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Unable to
complete login process due to delay in opening server connection.
Not really sure what that means. I've made sure SQL Server is configured to allow remote connections and have used netstat -a and seen that it's listening on port 1433 (for all IPs).
Anyone got any helpful ideas? I've rebooted the server too, but that didn't change anything.
EDIT/UPDATE: from my desktop I can ping the server by host name and I get something like this:
Reply from fe80::9077:4449:4b37:cad1%12: time<1ms
but if I try to ping it by it's IP address it times out. I wonder if that points to some kind of IPv4 vs. IPv6 issue?
Is the IP adress resolved from your desktop the actual ipadress of the server ?
Run a ipconfig /all from the server, and do a nslookup from your desktop to see if IP addresses are matching. I had cases when the DNS was messed up, and IP address resolution was wrong.

Resources