ASP network programming: How to open a remote MDB file with ASP

Source: Internet
Author: User
Tags dsn odbc connection ole

If you use an ODBC connection (DSN or dsn-less) to access the remote (UNC path) database, OLE DB will 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 you need permission to view its data.

You can avoid this error--asp and ActiveX support two ways to open an MDB file's dsn-less connection, or access the 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 be sure that users who use ASP have NT databases and shared access rights.

If you have permission, you can also access open data connections from other machines:

http://www.pstruh.cz/

Set UM = CreateObject ("Usermanager.server")

Rmi LogonUser "Login with the rights", "Password", "Domain"

...

Open Database

...

Rmi RevertToSelf

Shanghai treatment of Impotence Hospital Program I hope that you understand the use of ASP open the remote MDB file method, if you still do not understand the place can also contact me yo!

ASP network programming: How to open a remote MDB file with ASP

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.