Connect Remotely to SQL Server Express instance hosted on Google Compute Engine - sql-server-express

I'm trying to access SQL Server Express installed on Windows Server 2012 on Google Compute Engine VM. I have assigned STATIC IP to the instance and also added an exception to the firewall in Windows for port 1433 as well as in via console area of Compute Engine and allowed my IP in authentication.
I tried connecting the instance remotely via STATIC IP and Instance Name (IP\instancename) using SQL Server authentication, I have also configured SQL Server to accept remote connections as well as enabled TCP/IP from Configuration Area.
I'm still unable to connect to the Instance remotely can any one suggest me how to do.

Related

Can't reach my SQL Server hosted in a Windows Server VM, any ideas?

Well, I'm having the following situation.
I'm trying to set up a testing environment which consist of having a SQL Server on a Windows Server VM hosted on Google Cloud Platform (GCP). So far I've installed SQL Server on the VM and configured an instance with SQL authentication. Then I installed SMSS to access using the instance name and my credentials. At this point everything works well.
The problem comes when I try to access my SQL Server via SMSS from another computer. As the instance I'm using my GCP VM IP Adress and the credentials I've created before. The error is as follows:
So far I've done the following configurations:
Enable TCP/IP via SQL Server configuration manager.
I made sure that port 1433 was properly configured in the TCP/IP properties.
Created a new inbound rule on the Firewall to allow TCP connections using port 1433.
On the SMSS, checked that allow remote connections is enabled.
Restarted SQL Services from SQL Server configuration manager and services.msc
With above configurations it should work! But I've no idea what's happening.
Anyone who could give me a hint of how this could be solved, I'd appreciate it.

How can I identify what is blocking port 1433?

I like to consider myself a fairly smart individual with the superb ability to "Google" things. However, I am running into an issue that is driving me insane.
I am trying to connect to a Microsoft Azure SQL Server from my Alienware Laptop running Windows 10, over 5Ghz WiFi. It seems that something is blocking port 1433 (according to many Google results). Unfortunately, I have opened this port on my Nighthawk router, through Windows' Firewall (wf.msc) via inbound rule, and finally I have enabled port 1433 in Bitdefender for all applications. I still cannot connect to the SQL instance through SSMS (even tried DBeaver). I am getting TCP rejection messages "forcibly closed by remote host"
Here is the kicker. I can access my database on the same device through a vb.net application (though I believe this is a different port). The bottom line is, I know the credentials, I am the admin, but I cannot get port 1433 truly open.
What other steps can I try to remedy this situation? Any and all help will be appropriately credited.
You should open the port 1433 for outbound traffic from your local network instead of the inbound, also make sure you have added your client public IP address in your Azure SQL server firewall via the Azure Portal.
The full troubleshooting steps as below:
Ensure you have the appropriate ports open outbound from your local network or connection (typically port 1433)
Create a server-level firewall rule for your SQL database using the Azure portal.
Ensure you are using the correct server name and username for SSMS, the server name should be something like this: mynewserver20170313.database.windows.net.
Ensure you are using SQL Server Authentication
For SSMS the username format is username#servername
Ref: Use SQL Server Management Studio to connect and query data

Connect to Sql Server 2014 database into Azure VM

I just created a new SQL Server 2014 VM from Windows Azure gallery. I did remote login into VM , on trying to login into DB with Windows Authentication mode, I get below error:
Login failed for user 'dbserver\dba1'. (.Net SqlClient Data Provider)
Are there any specific steps, which I have to follow for new SQL Server DB login to work properly?
P.S. I have opened port 1433 into windows firewall, it did not help, althoug that should not be required for logging in directly from VM.
I guess Azure VM is not joined to domain. This means that only SQL authentication will work against this SQL Server instance. You might need to do the following:
Enable Mixed authentication on the SQL Server
Add a user mapped to SA role (or enable SA and set its password, but having separate user is better)
Open port 1433 (you did this already)
Make sure SQL is listening on this port (should be already)
In case you connecting outside of the same Azure Cloud Service - make sure you have endpoint created for the VM. Highly recommended to use port different from 1433 as the endpoint public port.
Don't forget to specify port if it is not standard, SQL connection string expects comma for it (i.e. myvmpublicname.cloudapp.net,12345)
You can check this article for more details
I was getting connection inside the VM using MSSQL Server, but not from outside. After reading some comments, I found that I needed to add a specific port for outgoing traffic and added that port at Azure firewall:
Here are the steps to check is it working for you or not:
Start Sql Server configuration Manager
Click on your Server name
Click SQL Server network config
Click on protocols
Click on TCP/IP
At the end of tcp/IP range set your port, I set 1433.
Please restart SQL Database.
Now open port at Azure management portal. And conntect through SQL tools or other services.
And also remember to open windows firewall.
It most likely installed another windows user as the admin for the SQL Database. If you know what that user is, login as them.
Otherwise, did you manage to set up the SQL in mixed mode and have an sa password. If so, login with that then add the Windows Account.
If not, try Forgot SQL Server Password to reset the sa password and get access that way.

SQL Server Express - Connect from remote machine

I have two Win 7 64 bit machines.
On the first one I have installed SQL Server 2008 R2 Express and have no trouble connecting via Management Studio with Windows Auth and also via SQL Auth with a user I set up on the database.
On the second machine I am trying to connect to the database on machine 1 using Management Studio. I'm trying SQL Auth. I therefore obviously also can't connect to it via connection string in my .NET Code
I can ping the first machine from the second.
Things I have tried include the following:
On the machine the database is installed make sure the firewall is allowing connection on Port 1433
Made sure SQL Server service is running
Made sure SQL Server Browser service is running
Created an exception for sqlbrowser.exe in the firewall
Enabled TCP/IP Protocol through SQL Configuration manager
Allowed Remote connections in SQL Server Management Studio
The error I get 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
This is the connection string I use in code
Data Source=xxx.xxx.xxx.xxx\sqlexpress;Initial Catalog=dbName;User Id=myUser;Password=myPassword;
This can be caused by a number of reasons but I'm glad my suggestion about checking firewall ports (rather than just allowing a one-way exception for SQL Browser) led you to the answer: the firewall wasn't allowing the correct port # through.
If i remember correctly SQL Server disables remote connections by default.
Please check whether remote connections are enabled and enable them if not:
RMB on Server in Management Studio Object Explorer -> Properties -> Connections -> Allow remote connections...

Why can I not connect to SQL Server using IP address, but works with server name?

I have a server hosted in Amazon's cloud (EC2, AWS), where I have SQL Server installed. With SSMS on the server, I can connect to the server instance using the Amazon server name and the SQL Server instance. However when I use the IP address, I cannot connect.
I have Allow Remote Connections to Server checked.
Similarly, I am unable to connect to the SQL Server instance remotely.
How can I resolve this?
Ensure you have enabled port 1433 to your specific public ip address in the appropriate security group.
You may also have to update the windows firewall config to allow the service to accept connections.
JL