Method for opening remote MDB files with ASP

zhaozj2021-02-16  65

If you use ODBC Connection (DSN or DSN-LESS) to access the remote (UNC path) database, the following error message will appear:

Microsoft OLE DB Provider for ODBC Drivers Error '80004005'

[Microsoft] [ODBC Microsoft Access Driver] The Microsoft Jet Database Engine Cannot Open THE '(UNKNOWN)'. It is already Opened Exclusively by Another User, or You Need Permission to View ITS Data.

You fully avoid this error --ASP and ActiveX support for two ways to open the MDB file DSN-Less connection, or access MDB files by other machines.

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 determine the use of the ASP's users with NT databases and shared access.

If you have permissions, you can also access open data connections in other machines:

http://www.pstruh.cz/

Set um = creteObject ("UserManager.server)

Um.logonuser "Login with the Rights", "Password", "Domain"

...

Open Database

...

Um.reverttoselff

转载请注明原文地址:https://www.9cbs.com/read-23960.html

New Post(0)