Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access violation exception with ADO library (msado15.dll) #202

Open
hyundonk opened this issue Aug 8, 2024 · 8 comments
Open

access violation exception with ADO library (msado15.dll) #202

hyundonk opened this issue Aug 8, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@hyundonk
Copy link

hyundonk commented Aug 8, 2024

Describe the bug

When querying with ADO library (msado15.dll), it gets access violation exception.

Below is sample test code.

#include <iostream>
#include <comdef.h>
#include <atlbase.h>
#include <atlsafe.h>
#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")

void InitializeCOM() {
    HRESULT hr = CoInitialize(NULL);
    if (FAILED(hr)) {
        std::cerr << "Failed to initialize COM library." << std::endl;
        exit(1);
    }
}

void UninitializeCOM() {
    CoUninitialize();
}

void ExecuteQuery() {
    _ConnectionPtr pConn;
    _RecordsetPtr pRst;

    try {
        // Initialize the connection
        HRESULT hr = pConn.CreateInstance(__uuidof(Connection));
        if (FAILED(hr)) {
            _com_error err(hr);
            std::wcerr << L"Failed to create Connection instance: " << err.ErrorMessage() << std::endl;
            return;
        }

        // Connection string
        //_bstr_t connStr = L"Driver={MySQL ODBC 8.0 Unicode Driver};Server=my-server-address;Database=databasename;User=admin;Password=mypassword;no_ssps=1;";
        _bstr_t connStr = L"Driver={AWS ODBC Unicode Driver for MySQL};;Server=my-server-address;Database=databasename;User=admin;Password=mypassword;no_ssps=1;";

        // Open the connection
        pConn->Open(connStr, L"", L"", adConnectUnspecified);

        // Initialize the recordset
        hr = pRst.CreateInstance(__uuidof(Recordset));
        if (FAILED(hr)) {
            _com_error err(hr);
            std::wcerr << L"Failed to create Recordset instance: " << err.ErrorMessage() << std::endl;
            return;
        }

        // SQL query
        _bstr_t sql = L"SELECT * FROM sample LIMIT 5;";

        // Execute the query. I got exception here!
        pRst->Open(sql, _variant_t((IDispatch*)pConn, true), adOpenStatic, adLockReadOnly, adCmdText);

        // Process the results
        while (!pRst->EndOfFile) {
            std::wcout << (LPCWSTR)(_bstr_t)pRst->Fields->Item[L"your_column"]->Value << std::endl;
            pRst->MoveNext();
        }

        // Close the recordset and connection
        pRst->Close();
        pConn->Close();
    }
    catch (_com_error& e) {
        std::wcerr << L"COM error: " << e.ErrorMessage() << std::endl;
    }
}

int main() {
    InitializeCOM();
    ExecuteQuery();
    UninitializeCOM();
    return 0;
}

When using MySQL ODBC 8.0 Unicode Driver, I don't see such exception error. Please help on this.

Expected Behavior

No exception error when querying with ADO library

Were cluster failover and/or enhanced failure detection enabled? Were any AWS authentication methods used? What other connection properties were set?

N.A.

Current Behavior

When querying with ADO library (msado15.dll), it gets access violation exception.

Reproduction Steps

Sample code provided

Possible Solution

No response

Additional Information/Context

No response

The AWS ODBC Driver for MySQL version used

1.0.0

Operating System and version

Windows 2019

@hyundonk hyundonk added the bug Something isn't working label Aug 8, 2024
@karenc-bq karenc-bq self-assigned this Aug 8, 2024
@karenc-bq
Copy link
Contributor

Hi @hyundonk, thank you for raising this issue. I am able to reproduce it and I am looking into it now, will keep you posted.

@InnovBase
Copy link

Hi, Any update.. I am facing the same issue... do you have any work around until the next release?

@karenc-bq
Copy link
Contributor

Hi @InnovBase, we have root caused the issue and was verifying the fix. We understand this is a blocking issue for you so we will be doing a patch release next week, thank you for your patience.

@karenc-bq karenc-bq mentioned this issue Sep 4, 2024
2 tasks
@karenc-bq
Copy link
Contributor

Hi all, we released the fix in version 1.1.0. Please let us know if you are still seeing this issue.

@InnovBase
Copy link

Salaam... Same issue with version 1.1.0. screen closed once you press test or drill the database combobox

@InnovBase
Copy link

here you are Event Viewer error description: Faulting application name: odbcad32.exe, version: 10.0.20348.1, time stamp: 0xf73007ad
Faulting module name: MSVCP140.dll, version: 14.29.30153.0, time stamp: 0x653aa208
Exception code: 0xc000041d
Fault offset: 0x0000000000013080
Faulting process id: 0xa7c
Faulting application start time: 0x01db083d9ca12920
Faulting application path: C:\Windows\system32\odbcad32.exe
Faulting module path: C:\Windows\SYSTEM32\MSVCP140.dll
Report Id: 052a6691-df04-45ce-828e-73858b946d01
Faulting package full name:
Faulting package-relative application ID:

@karenc-bq
Copy link
Contributor

Hi @InnovBase, could you please clarify if you are still experiencing the access violation exception or this other issue ? Could you please let us know if the suggestion in that thread works for you? Thanks.

@InnovBase
Copy link

Yes, the suggestion resolved ODBC connection problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants