How to open a remote MDB file with ASP _ Application Tips

Source: Internet
Author: User
Tags dsn odbc odbc connection ole
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.