Skip to content

Access provider: Jet OLEDB:Database Password not picked up #2

Description

@jeffreyheping

Hi Pieter,

First a small note of appreciation: I just spent some time running a fairly gnarly legacy app on ASPPY, and the completion level honestly surprised me. The VM, the ASP object model, ADODB, Global.asa — it all hangs together in a way I have not seen from a pure-Python VBScript implementation. And because it's Python, I can introspect anything I want with a debugger. No recompile, no native symbols, no "where is the source." That alone makes ASPPY a pleasure to dig into compared to wrestling with a black-box runtime.

One concrete issue I ran into, on a password-protected Access database.

Classic ASP apps often write the password into the OLE DB connection string with the property name Jet OLEDB:Database Password=.... This is the standard, documented form — see practically any old sample using Microsoft.Jet.OLEDB.4.0.

ASPPY classifies the connection correctly as access, but when building the underlying ODBC connection string in ASPPY/adodb.py (around the _AccessProviderAdapter.open method), it only looks for the keys password and pwd. The Jet-specific jet oledb:database password is silently dropped, so the ODBC driver is opened without a password and the connection fails.

My test case:

' core/db.asp
If DB_TYPE = "access" Then
    connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(DBaccess_SOURCE)
    If DBaccess_PWD <> "" Then
        connStr = connStr & "; Jet OLEDB:Database Password=" & DBaccess_PWD
    End If
End If
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connStr

With a non-empty DBaccess_PWD, this fails; with an empty password it works. The fix is to recognize the Jet-specific attribute name when extracting the password. One-line change:

pwd = _pick_attr(info.attrs, 'jet oledb:database password', 'password', 'pwd')

I would love to send a small PR with this and a test if you're open to it.

Thanks again for keeping this technology alive — and for doing it in a language that is so approachable to read and extend. ASPPY is doing genuinely important work for the people who still care about these applications. I will be watching the project closely.

Have a great week.

Jeffrey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions