Open a remote MDB file with ASP
If you use an ODBC connection (DSN or dsn-less) to access a remote (UNC path) database, OLE DB may receive the following error message:
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 your need to view its data.
You can totally avoid this error.--asp and ActiveX support two ways to open an dsn-less connection to an MDB file, or to access an MDB file by another machine.
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)
You have to make sure that users with ASP have NT database and share access rights.
You can also access open data connections in other machines, assuming you have permission:
http://www.pstruh.cz/
Set UM = CreateObject ("Usermanager.server")
Um. LogonUser "Login with the rights", "Password", "Domain"
...
Open Database
...
Um. RevertToSelf