Access ошибка подключения к sql серверу

I use a Microsoft Access 2010 front end with linked tables on an SQL Server 2012 installation. Local network.
When Access Starts, a VBA script runs which connects to the SQL server and performs some checks.
I recently upgraded from SQL Server 2008 to 2012, that’s when the connection between client and Server started to fail intermittently.

When the connection between my client and the server fails, I see a generic message «SQL Server does not exist or access denied». This is covered in a Microsoft support article http://support.microsoft.com/kb/328306. The potential causes detailed in that article do not match the trouble I am encountering.

This connection issue is intermittent. The trouble arises about 3 times a week and lasts for about 30 minutes at a time. Between these 30 minute failures, the the system works perfectly.

My Current VBA Connection String: (have tried several, trouble persists with all of them):

Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Open "Provider=SQLOLEDB;Server=Server3.companydomain.local;Database=My_Database;Trusted_Connection=Yes"

I hope that I can find something in the SQL Server Logs (which I do have access to) but I do not know which Log file to investigate.

Debugging

«SQL Server does not exist or access denied.» One error. Dozens of possible causes. Read on for a bunch of practical troubleshooting tips.

  • Mike Wolfe


6 min read

Troubleshooting SQL Server Connection Errors

One of the most frustrating things to troubleshoot in Access is when you can’t connect to SQL Server.

Connection failed: SQL Server does not exist or access denied.

Microsoft SQL Server Login
Connection failed:
SQLState: ‘01000’
SQL Server Error: 67
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).
Connection failed:
SQLState: ‘08001’
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.

This error is annoying because:

  • it often involves a 60-second timeout
  • it’s impossible to trap using traditional VBA error handling
  • the error message is close to useless
  • there are so many possible causes for this error
  • it often occurs on a user’s computer making it (A) hard to troubleshoot and (B) impossible to reproduce on a development computer

In this article, I want to take you through some of the troubleshooting steps that I use when trying to resolve this error.

Is the Server Reachable?

The first tool to use here is ping.  Open a command prompt and type the command ping followed by the name of the database server:

C:\> ping MyDbServer

Can you ping the server by IP address but not by name?  If so, then there’s likely a DNS problem.  

C:\> ping 10.20.30.40

Can’t ping the server by IP address or name?  Try a tracert next.  The trace will often bounce from node to node until it hits a deadend.  The last node prior to the deadend should provide a hint as to where the problem lies.

C:\> tracert 10.20.30.40

If one or more of these tools fails to connect, it should help you narrow down the source of the problem.  HOWEVER, some network admins disable ICMP (the ping protocol), so just because ping fails that does not necessarily mean it’s a network problem.  Continue on to the next section.

TIP: Virtual private networks (VPNs) are frequent sources of intermittent network routing and DNS problems.  Try disconnecting any active VPNs (unless needed to connect to the database server).

Is the Port Open and Listening?

Ensure the SQL Server port is open and listening.  The default port is 1433, but that can be set to something different.  You can use PowerShell to test TCP access:

Test-NetConnection -ComputerName MyDbServer -Port 1433 

If you can ping the computer but the above command fails, then there are two likely possibilities:

  • there is a firewall between your computer and the server blocking access to the SQL Server port
  • the SQL Server service is Stopped and needs to be started

Is TCP/IP Enabled at the Server?

If you are trying to connect to a brand new database server, then the problem could be at the server itself.  Open SQL Server Configuration Manager and make sure that TCP/IP is Enabled:

Does the User Have Needed Permissions?

When you can connect to the database from your development computer, but another user can’t connect from their computer, it could be a permissions issue.  One way to rule that out is to try running the application with your credentials from the user’s computer.

On the end user’s computer, launch Access as a different user:

Enter your user credentials and then try to connect to the database.  

If you are able to connect while running as a different user, then chances are it is a permissions problem.  

Verify that:

  • the user has been granted access to the database OR
  • if you assign rights to Active Directory security groups, verify they are a member of the expected security group

NOTE: this only makes sense if you are using Windows Authentication to connect to SQL Server.

Troubleshooting Tip: /runas /netonly
If you get a message about a missing «trust relationship» using the above approach, you may need to fall back on using a combination of the /runas and /netonly flags.  See here for details.  


Reader Clarification: Network vs. Database Permissions

UPDATE [2022-12-26]: As Philipp Stiefel points out in the comments below, there are two different kinds of permissions that could be blocking access to the database (or a particular table, stored procedure, view, etc.).  Here’s Philipp’s explanation:

The «access denied» part of the quoted error message only pertains to access on network level, as you covered in the «Server Reachable?» and «Port Blocked?» sections. The message does not apply to missing permissions in SQL Server. Missing permissions will raise the different error message: «Login failed for user ‘YourUserName'» (SQL Server-Error 18456). Being aware of these different error messages will get you to the cause of the problem quicker.

Thanks for the clarification and explanation, Philipp!


Monitor Access Attempts from SQL Server

Open SSMS and connect to the database server from your development computer.  Launch a «Standard» XEvent Profiler session.  

Then attempt to connect from the end user’s computer.  Review the entries logged in the XEvent session for hints as to why the user is failing to connect:

ODBC Data Source Administrator

If you don’t have access to the database server or a copy of SSMS, you can use the ODBC Data Source Administrator to do some basic debugging from the client side.

Press [Win] + [R] then type odbcad32.exe and click [OK]:

NOTE: Don’t worry about the «32» in the file name; this will open the 64-bit version if needed.

On the User DSN tab, click the [Add…] button.  Firstly, this will open up a list of available ODBC drivers.  One possible reason for failure is if the required ODBC driver is not installed on the end user’s computer.  This helps troubleshoot that possibility.

Follow the prompts to enter your server name and credentials.  The third screen should give you the option to set a default database.  If you check that box, you can use the dropdown to show all the databases that the user has access to.  If the desired database is missing from the list, but other databases are shown, then it’s likely a permission issue.

When you are finished creating your temporary DSN, you can click [Test Data Source…] to make sure everything is working correctly:

Viewing Available Tables from Excel

To see a list of tables the user has access to from a machine that does not have a full version of Access, but that does have a copy of Excel, you can use that to view what tables are available to the user.

Go to Data > Get Data > From Database > From SQL Server Database

Enter the requested information in the dialog boxes.  Assuming you are able to connect to the database, you should then see a list of tables to which the user has at least a minimal set of permissions:

Reader Tips

What methods and tricks do you use when troubleshooting SQL Server connections?  Let us know in the comments below.


Referenced articles

Checking Specific TCP Port Access to a Remote Machine

Troubleshooting network connections is tough. Generic error messages make it hard to identify the root of the problem. This PowerShell cmdlet can help.

No Longer SetMike Wolfe

Using Windows Authentication to Connect to SQL Server from Outside the Domain

You don’t need to join your computer to a domain to be able to connect to SQL Server using Windows Authentication. You just need to know this simple trick.

No Longer SetMike Wolfe

External references

Use the SSMS XEvent Profiler — SQL Server

The XEvent Profiler displays a live viewer of extended events. Learn why to use this profiler, key features, and how to get started viewing extended events.

Microsoft Docsyualan

Image by Christian Brinkmann from Pixabay

UPDATE [2023-07-19]: Added second possible explanation for failed TCP port access (SQL Server service is not running).

Have you ever encountered the issue of” SQL Server does not exist or access denied”? Then what’s your initiative to fix this out?  Do you know why you are getting these kinds of errors?

If no, then don’t worry as the following blog will help you in exploring more about this SQL Server does not exist or access denied error and ways to resolve it easily.

Rated Excellent on Trustpilot
Free MS Access Database Repair Tool
Repair corrupt MDB and ACCDB database files and recover deleted database tables, queries, indexes and records easily. Try Now!

Download
By clicking the button above and installing Stellar Repair for Access (14.8 MB), I acknowledge that I have read and agree to the End User License Agreement and Privacy Policy of this site.

Practical Scenario:

Today about 1 pm some users started receiving the following error. We had not made any changes, so I am not sure what is going on. The weird part is that at this same time it started using the sql browser with a different port at this same time. Any ideas would be helpful. 

(FOC1400) SQLCODE IS 17 (HEX: 00000011) XOPEN: 08001 : Microsoft OLE DB Provider for SQL Server: [08001] [DBNETLIB][ConnectionO : pen (Connect()).]SQL Server does not exist or access denied. L (FOC1406) SQL OPEN CURSOR ERROR.

source: http://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1647017686

SQL Server Does Not Exist Or Access Denied is common Microsoft Data Access Components (MDAC) message that gives a clear indication that the computer is running

Microsoft SQL Server can’t be contacted. The following are the potential causes of this dbnetlib connectionopen (connect()). sql server does not exist or access denied error message.

Besides that error messages also have similar causes.

SQL Server is unavailable or does not exist.

The specified SQL Server is not found. 

 SQL SERVER connectivity error

Well, the above error doesn’t indicate the following:

  • SQL Server Login process failure.
  • To process the query, SQL Server doesn’t have that much permission. 
  • You are unable to use SQL Server authentication because you have only got the permission of  Windows authentication.

Why You Are Getting “SQL Server Does Not Exist Or Access Denied” Error?

Well the following SQL Server does not exist or access denied errors occur when MDAC (Microsoft Data Access Components) message that shows the PC is running the SQL Server cannot be connected.

Here the possible causes for the occurrence of this error.

  • Maybe the SQL Server is currently unavailable or doesn’t exist anymore.
  • Remote connection is disabled for SQL instance.
  • Port is not added to the firewall exception list.
  • Maybe the IP address of the instance is blocked.

How To Fix The “SQL Server Does Not Exist Or Access Denied “Error?

Here are some best fixes to troubleshoot dbnetlib connectionopen (connect()). sql server does not exist or access denied error. Take a quick overview of it:

1: Check Whether the SQL Server is running or not

2: SQL Server instance is not available or does not exist

3: Remote connection is not enabled for a SQL Server instance

4: Port is not added in the firewall exception list

5: IP address of the SQL Server Instance has blocked the Firewall

6: connect remote SQL Server using Server Name

7: Allow the instance name to measure the connection information

Let’s discuss all these listed methods in brief….!

Method 1: SQL Server Is Running

The very first thing you need to do is to check that if the SQL server is running or not. to check this just type the “services.msc” command in the Run Window.

Method 2: SQL Server Instance Is Not Available Or Does Not Exist

Make a check for the connection strings and be sure that you are trying to connect the right server and it’s available on the network.

Method 3: Remote Connection Is Not Enabled For A SQL Server Instance

Check whether the remote connection is enabled or disabled. For this just open the SQL Server Management Studio -> Connect to SQL Server where it gets installed using SQL Server Management Studio ->Go to SQL Server instance property and make a check-in front of the Allow remote connection to this server option box.

Method 4: Port Is Not Added In The Firewall Exception List

It is also seen that SQL Server does not exist or access denied error message also encounters when SQL Server remote connection is enabled. But somehow the port is getting blocked by the administrator for security purposes.

By default SQL Server instance actually works on port no 1433, so you need to check that the port exception is get added to the firewall.

In order to check the port exception, just try the following steps:

    • Start with the Control Panel -> and then open Administrative Tool -> after then select Windows Firewall with Advanced Security.
    • From the left panel, tap to the Inbound Rules, and from the right panel select New Rule…
    • In the New Inbound Rule Wizard window, make a selection for the Port and after then tap the Next button.
    • In the next tab, enter ‘1433’ in Specific local ports and tap the Next button.
    • Within the “what action should be taken when a connection matches the specified condition?” Section. You have to make a selection for the Allow the connection option and after then tap to the Next option.
    • Make a check for the DomainPrivatePublic under which does this rule apply section? And tap to the Next option.
    • Assign a name for this and tap the finish button.

Method 5: IP Address Of The SQL Server Instance Has Blocked The Firewall

If you want to check whether the SQL Server does not exist or access denied 2016 error is occurring because of IP address, ping IP address on the command prompt like

Ping 100.10.10.10 –t

If you are getting a response from the server then it means there is no issue with IP Address blockage but if not, they need to add an exception.

Method 6: Connect Remote SQL Server Using Server Name

Step 1: First verify, the status of your protocol name.

1

After that, on the client-side, you have to make the alias.

Step 2: Now search for the cliconfig.exe present within System32 folder. After getting the cliconfig.exe  file, just tap on it.

2

Step 3: Now it’s time to make a TCP/IP alias. So, from the disabled protocols list choose the TCP/IP. After then hit on the Enable button.3

Now you will see that your selected TCP/IP protocol will get added under the section of Enabled protocols by order.

Note: please ensure that the list doesn’t contain any Named Pipe. Suppose if in the list you get any Named Pipes then immediately disable it.

Step 4: Next move to the tab “Alias”. 

4

Step 5: After then hit the Add button.

5

Step 6 :  Now in the section of “Server alias” you require to enter the SQL Server database’s Server name.

6

Step 7: And choose the section TCP/IP present in the options box of Network libraries.

In the same add network library dialog box, you will see a connection parameter section. here in the server name you need to enter the IP Address of the SQL Server. After that hit the OK option.

7

Note: SQL Server’s default port number is 1433.

Step 8: Then tap to the Network Libraries for verifying the entries.

8

And you can get an easy connection with the remote SQL Server by making use of the Server Name.

Method 7: Allow The Instance Name To Measure The Connection Information

SQL Server 2005: In SQL Server 2005, for measuring the connection detail the server gives an instance name.

Solution: The user needs to remember one thing, that the instance name must be included in the assigned Server name.  As shown in the figure.

9

You can view the Server Name that is included along with the instance name i.e P6Instance.

Please Note: At the time you choose the by default instances that is already present on your PC. Then this will automatically take upgrade by the setup of SQL Server. Apart from this, a single system can only host just a default single instance.

Conclusion:

In the above blog, you must have got the possible reasons for SQL Server does not exist or access denied error and explained the solution to resolve the error.

tip Still having issues? Fix them with this Access repair tool:

This software repairs & restores all ACCDB/MDB objects including tables, reports, queries, records, forms, and indexes along with modules, macros, and other stuffs effectively.

  1. Download Stellar Repair for Access rated Great on Cnet (download starts on this page).
  2. Click Browse and Search option to locate corrupt Access database.
  3. Click Repair button to repair & preview the database objects.

Pearson Willey is a website content writer and long-form content planner. Besides this, he is also an avid reader. Thus he knows very well how to write an engaging content for readers. Writing is like a growing edge for him. He loves exploring his knowledge on MS Access & sharing tech blogs.

  • Remove From My Forums
  • Вопрос

  • Вопрос таков

    Есть рабочая группа. На одном из компов стоит MS SQL Server на WinXP Pro SP2. На нем есть некая несложная база. Можно ли создать подключение к нему из Access, в котором создать формы отчеты и пр.?

    Или же нужно создать аналогичную по структуре базу в Access, а затем ее конвертировать на MS SQL Server?

Ответы

  • Да, можно. Создайте в ODBC Data Sources либо User DSN, либо System DSN с подключением к вашему SQL серверу. Затем в самом Access выберите пункт меню Файл — Внешние данные — Связь с таблицами и в появившемся диалоговом окне Связь укажите (внизу) Тип файлов — ODBC Databases. Перейдите на закладку Machine Data Sources и выберите созданный вами источник данных типа SQL Server.

    • Предложено в качестве ответа

      22 мая 2009 г. 10:20

    • Помечено в качестве ответа
      Nikita PanovModerator
      22 мая 2009 г. 10:20

Offtop  
До чего доводит лень…  

  Нужна была простая CRM система. Сделал в Excel — понял, что получилась фигня.  
Начал переписывать на Acess — понял, что долго и то же фигня.  
Сделал базу Acess и написал на VB .NET(первый раз столкнулся с VISUAL STUDIO И VB) собственную оболочку для юзеров.  

  Заработало, юзабилити отличная , но синхронизировал базы через FTP. Синхронизация шла через одно место.  

  Создал сайт на виндовс хостинге(ASP .NET тогда же впервые узнал, что такое бывает) с базой на MS SQL. Сделал WEB сервис, переписал базу (база одна, области «видимости» у всех разные), экспортировал данные из старой базы. Переписал клиентскую программу.  

  Сейчас 60+ пользователей работают в системе. В базе более 10 000 клиентов и более 150000 контактов. + появился сайт для пользователей системы с возможностью просматривать отчеты в онлайн и прочими плюшками. Начальство в восторге :-).  
А мог ведь просто сидеть и отчетики EXCEL от пользователей сводить, если бы лень не было.  

  P.s. понял, что VB фигня, читаю книжки по C#. Скоро начну все переделывать.  

  P.p.s. в прошлой компании бюджет на внедрение CRM был более 100 000 USD  

  Лень и только лень  ведут к прогрессу.  

  По существу вопроса. А почему вы на прямую к серверу не подключаетесь? Создайте в базе необходимые вьюшки или хранимые процедуры.

Понравилась статья? Поделить с друзьями:
  • Access ошибка ole
  • Access ошибка 438
  • Acronis ошибка 1069
  • Access ошибка 3326
  • Acronis ошибка 2203