PRB: Connection to Jet Database Fails If You Use DCOM and Database on Network (293805)



The information in this article applies to:

  • Microsoft Data Access Components 2.1 (GA)
  • Microsoft Data Access Components 2.1 SP1
  • Microsoft Data Access Components 2.1 SP2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.5 SP1
  • Microsoft Data Access Components 2.6

This article was previously published under Q293805

SYMPTOMS

When you use Distributed Component Object Model (DCOM) to connect to an ActiveX EXE file that connects to a Microsoft Jet database on a different server, you receive the following error message:
80004005 The Microsoft Jet database engine cannot open the file '|'. It is already opened exclusively by another user, or you need permission to view its data.

CAUSE

This problem occurs because you are using the "Launching User" identity to connect to the database. These credentials are available to the local computer only.

RESOLUTION

There are two ways to work around this problem:
  • In DCOMCNFG for the ActiveX EXE, set the identity of the launching user to either Interactive or to a specific user (domain) account that has permissions to the other computer.
  • Place the MDB file on the same computer as the ActiveX EXE. When you connect to the MDB file, be sure to use the absolute path (for example, c:\test.mdb) instead of a universal naming convention (UNC) path or mapped drive.

    Note: If the MDB file is located on an NTFS drive, you must modify permissions on both the directory and MDB file.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new ActiveX EXE, and paste the following code:
    Public Function TestIt(strCnn As String) As Boolean
       Dim cnn As ADODB.Connection
       Set cnn = New ADODB.Connection
       cnn.CursorLocation = adUseClient
       cnn.Open strCnn
       TestIt = True
    End Function
    					
  2. Create a new Standard EXE project in Visual Basic. Form1 is created by default.
  3. Add a Textbox control and a CommandButton control to Form1.
  4. Paste the following code:
    Private Sub Command1_Click()
       MsgBox TestIt(Text1.Text)
    End Sub
    					
  5. Register the ActiveX EXE on a Microsoft Windows NT-based computer. Make sure that the ActiveX EXE and the MDB file are located on a drive that uses NTFS.
  6. On a computer that is running Microsoft Windows 95 or Microsoft Windows 98, install the Visual Basic project, and register the ActiveX EXE.
  7. Run DCOMCNFG, and configure the server object to run on the Windows NT-based computer.
  8. Run the Visual Basic project.
  9. In the Textbox, type a connection string to a Microsoft Jet database that is located on the network (using a UNC path or drive letter, and using Jet 4.0 OLE DB Provider or ODBC)
  10. Click Command1. You receive the above-mentioned error message.

Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbDatabase kbDCOM kbnetwork kbprb KB293805