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



The information in this article applies to:

  • Microsoft Access 2002
  • Microsoft Access 2000
  • Microsoft Access 97

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

STATUS

This behavior is by design.

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.

REFERENCES

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

Modification Type:MinorLast Reviewed:8/6/2004
Keywords:kberrmsg kbprb kbDatabase KB830133 kbAudDeveloper