Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You receive an "unspecified error" error message when you create more than 64 connections to an Access Database in one process


View products that this article applies to.

Symptoms

If you connect to a Microsoft Access database and then you create more than 64 connections in one process, you may receive one of the following error messages:
  • In Microsoft Visual Studio .NET:
    Unspecified error
  • In Microsoft Visual Basic 6.0, if you use ActiveX Data Objects (ADO):
    Runtime-Error '-2147467259 (80004005)': Unspecified Error

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Steps to reproduce the behavior

  1. Start Visual Studio .NET.
  2. Use Microsoft Visual C# .NET or Microsoft Visual Basic .NET to create a new Console Application project. Name the project AccessApplication. By default, Class1.cs (in Visual C# .NET) or Module1.vb (in Visual Basic .NET) is created.
  3. In Class1.cs or in Module1.vb, replace the existing code with following code.

    Note To use this sample code, change the Data Source path to the path of any Microsoft Access database file that is on your computer.

    Visual C# .NET Code
    using System;
    using System.Data.OleDb;
    
    namespace AccessApplication
    {
    	/// <summary>
    	/// Summary description for Class1.
    	/// </summary>
      class Class1
      {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
          //
          // TODO: Add code to start application here
          //
          int intCount;
          int intMaxConnections;
          string strConnection;
    
          intMaxConnections = 65;
          object[] objArray = new object[intMaxConnections];
    
          strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" + 
            "Data Source=C:\\Program Files\\Microsoft Office\\Office10\\Samples\\Northwind.mdb;";
    			        
          Console.WriteLine("Starting test...");
    			
          for (intCount=0;intCount<intMaxConnections;intCount++)
          {
            try
            {
              OleDbConnection myConnection = new OleDbConnection(strConnection);
              myConnection.Open();
              Console.WriteLine("Open connection is " + intCount);
              objArray[intCount] = myConnection;
            }
            catch(Exception excpt)
            {
              Console.WriteLine("Exception : " + excpt.Message.ToString());
            }
          }
        }        
      }
    }
    
    Visual Basic .NET Code
    Imports System.Data.OleDb
    Module Module1
    
      Sub Main()
        Dim intCount As Integer
        Dim intMaxConnections As Integer
        Dim strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" _
            & "Data Source=C:\Program Files\Microsoft " _
            & "Office\Office10\Samples\Northwind.mdb;"
    
        intMaxConnections = 65
    
        Dim IntArray(intMaxConnections) As Object
        Console.WriteLine("Starting test...")
        For intCount = 0 To intMaxConnections
          Try
            Dim objConnection As New OleDbConnection(strConnection)
            objConnection.Open()
            Console.WriteLine("Open connection is " & intCount)
            IntArray(intCount) = objConnection
          Catch excpt As Exception
            Console.WriteLine("Exception " + excpt.Message.ToString())
          End Try
        Next
      End Sub
    
    End Module
    
  4. On the Debug menu, click Start.

↑ Back to the top


References

For more information about how to open an Access database by using ADO, visit the following Microsoft Developer Network (MSDN) Web site:

↑ Back to the top


Keywords: KB830133, kbdatabase, kbprb, kberrmsg

↑ Back to the top

Article Info
Article ID : 830133
Revision : 4
Created on : 9/17/2011
Published on : 9/17/2011
Exists online : False
Views : 305