Remote Control SQL Database
Remote Control SQL Database
Problem
Most of us, developers, love to write SQL code on our local machines not only
because they're executed faster, but also because we have a lot more control over
the data as it is used only by us and is not team dependent. This was the case in my
team until recently when the policy has changed and the new policy requires us to
develop using a centralized database that was being hosted on one of the on-
premise servers rather than using local SQL Servers for each individual developers.
There are both advantages and disadvantages to this approach. You can free up
some space and RAM from your local machine by disabling the SQL Server Services,
which can be an advantage for some. However, you'd need to connect to the server
now and write queries keeping in mind that other developers are also using the same
database. So, one should be aware of making any changes to the data.
The important steps to allow remote connections to an instance can be divided into
the following parts, which are discussed in detail below.
This article describes the steps on how to configure remote access on a SQL Server
instance and connect to it from a developer's machine using SSMS.
The SQL Server is not configured to be able to allow remote machines to connect to
this instance.
Once the SQL Server is configured, we need to allow decide users should be able to
connect and access the database objects. This is done by creating a SQL Login and
then assigning specific database roles to those users.
In this case, since all the machines are in the same domain, we will proceed with
the Windows Authentication mode.
1. Connect to the SQL Server instance as a server admin.
2. Expand Security and right-click on Logins.
3. Select New Login.
11. Navigate to User Mappings, and select the database on which the user needs
access to.
12. We can assign any specific role as security demands. In this case, I'm
assigning as db_owner.
13. On the Status page, select Permission as Grant and Login as Enabled and
click OK.
14. The new login will be visible under the logins in the SQL Server Object
Explorer.
Configuring the SQL Server Instance
Now that the database instance is configured for remote connections, we need to
allow remote traffic to be allowed on the server. This can be done by following the
steps below:
11. Select all the three options under Profile (This depends on whom do you want
to allow access to the database instance).
12. Click Next.
Now that everything has been set up properly to allow inbound traffic over the
firewall, we are ready to connect to this machine from any other machine in the
network. For this, we need to get the correct IP Address of the machine and
the Instance Name of the database (only in case of a named instance).
Once the remote server is configured, now we should be able to connect to the SQL
Database Instance from any other PCs.