Need help?

Our experts have had an average response time of 13.14 minutes in February 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to fix SQL error 4060

by | Jun 25, 2020

SQL error 4060 “Server rejected the connection; Access to the selected database has been denied” is a common error usually seen after website migration in Windows servers.

The reasons for this error include permission issues, firewall restrictions, etc.

As a part of our Server  Management Services, we help our customers to fix SQL related errors regularly.

Let’s today discuss the possible causes and fixes for this error.

 

What causes SQL error 4060?

Often after a migration, some users notice SQL error 4060 while applications or websites. This error states that the “Server rejected the connection; Access to the selected database has been denied“. As the error message states, access to the database was denied as the server rejected the connection.

 

SQL error 4060

To list out, the common reasons for this error include:

  • No permission to access the database using the credentials
  • Protocol not enabled
  • Firewall blocking access

Lets us now look into each of these reasons in detail and the possible fix for them.

 

Lack of Permission

The most common reason for the error 4060 is the lack of permission for the user to access the database. After migration, it is important to ensure that all the users in the previous environment are set up in the new environment as well with the required privileges. However, this is often a frequently missed point.

Correct permissions can be granted to the users with a proper TSQL command. A general format of the command is

GRANT  [ ,...n ]
TO  [ ,...n ] [ WITH GRANT OPTION ]
[ AS  ]

 

For instance, to grant SHOWPLAN permission on the Example database to application role Moderator, TSQL command to be used is:

USE Example;
GRANT SHOWPLAN TO Moderator;
GO.

Similarly, we could grant the required privileges to the user after comparison with that of the permission in the old environment.

 

Protocol not enabled

To connect to SQL Server Database Engine you must have a network protocol enabled. If those are not enabled, it may trigger the error 4060.

The steps to enable them are:

  • First, select Start, and in your list of programs, select SQL Server Configuration Manager.

  • Next, navigate to SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for .

    SQL error 4060

  • Then, double-click Named Pipes. The Named Pipes Properties screen appears.

  • From Enabled, select Yes. Then click OK.

    SQL error 4060

 

  • Similarly to enable TCP/IP, we can select TCP/IP as in step 2. The TCP/IP Properties screen appears.

  • Next, on the Protocol tab, ensure Yes is selected for Enabled. On the IP Addresses tab, ensure that Yes is selected for the appropriate IP Address. Also, ensure that the appropriate TCP Port is indicated. Then click ok.error 4060

  • Finally, from SQL Server Management Studio, restart the server instance.

    SQL error 4060

 

Firewall blocking Access

Firewall restrictions can also trigger the error 4060. To fix it, we need to allow access in firewall. Generally, a closed port is the most common restriction that Firewall places. To fix it, we need to open the port in the firewall for the client.

Apart from the common reasons mentioned above, some other reasons can also trigger this error. In a rare case scenario, this error could also indicate that the corresponding database is not copied over to the new environment. Thus it is not a bad idea to cross-check if the database is actually copied over before we go for any other complex fixes.

 

[Need help to fix SQL errors? We are available 24×7]

 

Conclusion

In short, lack of permission for users to access database, firewall restriction etc trigger the error 4060. Today, we discussed how our Support Engineers fix the error “Server rejected the connection; Access to the selected database has been denied”.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF