Open MDB Files on a Remote Computer

If you use ODBC connection (DSN or DSN-less) to file on remote computer (UNC path), OLEDB raises next error :

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

You can avoid the error - ASP and ActiveX supports two ways to open DSN-less connection to MDB file (or connection to MDB file from another computer).
1. DAO database (only for small load)

  Dim File, Conn, RS
  Const ReadOnly = False
  File = "\\server\share\file.mdb"
  Set Conn = CreateObject("DAO.DBEngine.35").Workspaces(0).OpenDatabase(File,,ReadOnly)
  Set RS = Conn.OpenRecordset(SQL)
2. ADO + Jet OLE DB provider
  Dim Conn, RS
  Set Conn = CreateObject("ADODB.Connection")
  Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
  Conn.Open "\\server\share\file.mdb"
  Set RS = Conn.Execute(SQL)
Be sure that the user running ASP (probably IUSR_...) has NT access rights to the share and the database.
You can also logon to another NT user account with the rights before openning connection :
    Set UM = CreateObject("UserManager.Server")
    UM.LogonUser "Login with the rights", "Password", "Domain"
...
open database
...
    UM.RevertToSelf


Open MDB Access Database Remote computer another UNC path 80004005


Back To Top
© 1998 - 2024 psacake.com
Version 7.21 | Advertise on this site