5-Minutes Fix: Run Time Error 3151 ODBC Connection Failed!

When using the ODBC protocol to connect to Microsoft Access, you may experience run time error 3151 ODBC connection failed. Here is the complete error that pop-up on your screen:

run time error 3151 ODBC connection failed

This error is triggered due to several reasons and can be easily fixed. In this write-up, I will discuss the possible causes and effective workarounds to get rid of the MS Access ODBC connection failed error. Also, I’ll mention the professional Access Repair & Recovery Tool to solve this error with less effort if it arises due to database corruption.

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.

Quick Fixes:

But before proceeding further, let’s know something about ODBC & ODBC – connection to <name> failed. (Error 3151).

Short Information On ODBC Data Sources

ODBC (Open Database Connectivity) is one such protocol that is mainly used to connect MS Access database to any other external data sources like Microsoft SQL Server. On the other hand, ODBC Data Source is a combination of source data and the connection information which is needed to access that particular data. Here are a few examples of Data Source: SQL Server, a spreadsheet, Oracle RDBMS, and text files.

Whereas an example of connection information comprises server location, database name, login ID, password, and various ODBC driver options which define how to get connected to data sources. Well, such information can be achieved from the database administrator to which you want to get connected. In Access, ODBC data sources are used to connect data sources external to Access that don’t contain any built-in drivers.

What Is ODBC Connection Failed 3151?

Odbc Connection Failed Error is a very common claimed error message by several of the access database users. It is observed that this type of ODBC Connection issue generally arises when some changes are done in SQL servers with a new name, IP, and DSN; or the creation of a new ODBC and modification done in link tables.

On the other hand, we can say, error code 3151 is a result of ODBC connection failure in MS Access. However, countless causes may lead to this error. Below I have listed the major ones:

  1. Network connection problem
  2. Inappropriate SQL Server Authentication.
  3. Access database corruption.
  4. Making changes to the link tables
  5. When changes are made in SQL servers, like providing a new name, IP and DSN.
  6. Windows Firewall is restricting the connection
  7. Improper TCP or Tracing settings.

How to Fix Access Run Time Error 3151 ODBC Connection Failed?

To solve this runtime error, here are the possible fixes mentioned. Let’s see what the first method says:

Way 1- Fix “With SQL Server Authentication” Option

At the time of the creation of an ODBC connection to the SQL server, make the selection of the login ID and password given by the user.  Make confirmation of the same thing in Microsoft Access, where System Data Source and Machine Data Source have been used to create the ODBC connection.

Here is how to perform this procedure –

  • Open your MS Access Database >> go to a File menu >> click on Get external data >> Link tables options.

File option, click External Data

  • Now from the File Types list, choose the ODBC database.

File option, click External Data

  • Hit the Machine Data Source option.
  • Tap to the New option.
  • Choose the System Data Source and select the Next option.
  • Now hit the SQL Server option. After that tap to the Next and then finish option.

File option, click External Data

  • Assign a name for ODBC connection and SQL Server in the given text boxes.
  • Hit the next option and make a check over the “With SQL Server authentication using a login id and password entered by the user” option.
  • Hit the Next and select the appropriate database.

Run Time Error 3151 ODBC Connection Failed

  • Click Next and Finish. At this time you may test the ODBC connection to SQL Server.
  • Click OK more than a few times until you come back to the SQL Server login page.
  • Enter the login ID and password to the SQL server database and hit the OK option.
  • Now, select Save Password checkbox.

After trying out the above steps you must have overcome the issue of ODBC Connection for an Access Database. But if in case it isn’t successful, approach the second one.

Also Read: Fix Access Error 1919. Configuring ODBC Data Source

Way 2- Set Up An ODBC Connection For An Access Database

It’s important to perfectly set up the ODBC connection for the Access database. So, just check out whether you have done it correctly or not. This will also help you in learning how to set up an ODBC connection for Access Database with form error.

1. On your Windows desktop tap to the Start >Settings > Control Panel > open the Administrative Tools control panel.

2. After opening the Administrative Tools window make double-click on the Data Sources (ODBC).

3. Now In the ODBC Data Source Administrator dialog box, hit the Add.

ODBC Data Source Administrator

4. After that open the Create New Data Source dialog box, hit the Microsoft Access Driver (*.mdb), and then to the Finish

5. For assigning the data source name to enter Parcel_Owners, in the ODBC Microsoft Access Setup dialog

6. Also, enter its description like “Parcel owner information.”

7. In the same dialog box under the Database option, click the Select.

8. After this Select Database dialog box will open on your screen, search for the sample files, and choose the Assessor.mdb file. You need to specify the database for the data sources.

9. Tap to the OK option in all the opened Select Database, ODBC Microsoft Access Setup, and ODBC Data Source Administrator dialog boxes.

10. After completing this entire task, close the Administrative Tools control panel.

Way 3- Enable the Tracing Options

Many users have reported that they received run time error 3151 ODBC connection failed due to an issue with the ODBC tracing capabilities.

Well, you can easily troubleshoot this error by configuring the ODBC Administrator Tracing tab.

Here is how you can do so:

  • Sign in to Local Administrators group.
  • Next, go to Administrative Tools >> click on “ODBC Data Source Administrator”.
  • Choose a Tracing tab.
  • Select the checkbox “Machine-Wide Tracing for all identifies”.
  • Select the machine-wide tracing checkbox to enable it.
  • Now, clear a checkbox to go back to per user tracing >> hit Apply.

Machine-Wide Tracing for all identifies

Way 4- Enable the Settings of Named Pipe

Generally, the Named Pipe protocol is used to establish the connection between the network users & MS SQL Server. However, the Open Database Connectivity (ODBC) connection might fail if the Named Pipe protocol is turned OFF.

You can simply follow the steps below for enabling this protocol’s setting:

  • Go to the Control Panel on your PC.
  • On the page of “All Control Panel Items” >> click Windows Administrative Tools.
  • Then, make double-click on the Local Security Policy.

Local Security Policy

  • Under the Local Security Policy, you have to click on Security Settings >> Local policies.
  • After this, click on Security Options>> right-tap on the “Network access: Named Pipes that can be accessed anonymously” option >> choose Enabled option.

Security Options

Also Read: Fix MS Access ODBC Call Failed 3146 Error Easily

Way 5- Fix Run Time Error 3151 ODBC Connection Failed by Checking TCP Connection

You can simply check for the active IP Statistics & TCP connection by following the beneath steps:

Step 1- First, press Win + R keys then enter ‘CMD’ >> OK to launch the Command Prompt window.

Step 2- Under Command Prompt >> enter the below command:

netstat -n –a.

Run Time Error 3151 ODBC Connection Failed

Way 6- Repair Corrupt Access Database

As mentioned in the causes section, corruption in the database can also trigger a connection to <name> failed. (Error 3151). In such a case, you can use the Access in-built Compact & Repair tool.

Here is how you can do so:

  • Open your Access database.
  • Click on File then Info.
  • After this, find and click on Compact & Repair Database.

Repair Corrupt Access Database

Recommended Option to Keep Access Database Safe And Error Free:

If you want to keep your access database files safe and free from any corruption glitches then also keep a proper and updated backup of your Access database.

But if you are already dealing with the access database corruption issue or the error conquered then also you need not worry about it.  Just try the professional Access Database Repair And Recovery tool to effectively repair Access database MDB/ACCDB files.

This MS Access recovery software works efficiently to repair corrupt/damaged Access databases. Apart from that the software deeply scans every segment of the corrupted access database and removes all glitches from it. The tool is just perfect for recovering all the items of Access Database files like Tables, Queries, Indexes, Macros, etc. safely and securely without any issue.

* By clicking the Download 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.

Steps to Use Access Repair Tool

access-repair-main-screen
access-select-database
access-repairing
access-repairing-completed
access-preview
access-save-location
access-saving
previous arrow
next arrow

Related FAQs:

Can A Firewall or Antivirus Software Cause the Access ODBC – Connection To <Name> Failed. (Error 3151)?

The answer to this question is Yes, the firewall or antivirus software may hinder the ODBC connection, leading to the Access error 3151.

Why Am I Encountering the ODBC Connection Error Specifically with Runtime Error 3151?

You are encountering the ODBC connection error with the 3151 code due to either improper TCP settings or network connection issues.

How Do I Fix Access Database Error 3151?

Implementing the below techniques, you can fix Access database error 3151:

  1. Set Up an ODBC Connection for Access Database
  2. Enable the Tracing Options
  3. Enable the Settings of Named Pipe
  4. Checking TCP Connection.

Also Read: ODBC Microsoft Access Driver] Cannot Update. Database Or Object Is Read-Only Error

Final Verdict

The Access runtime error 3151 ODBC connection failed can occur due to various reasons. However, you can follow the aforementioned methods to troubleshoot this error.

In case, this error arises due to corruption in the database, you must opt for Access Repair Tool. It’s designed with a simple UI for repairing corrupt database files in no time. Also, it can help you to recover all the objects from a corrupted file without any data loss.

I hope you liked this post.

References:

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.