Open ADODB connection in wine using mysql-connector-odbc

Questions about Wine on Linux
Post Reply
Merlot
Newbie
Newbie
Posts: 3
Joined: Fri Nov 30, 2018 11:14 am

Open ADODB connection in wine using mysql-connector-odbc

Post by Merlot » Fri Nov 30, 2018 11:24 am

Hello

Tried wine-2.9, wine-3.0 and wine-staging-3.18

About a year ago I got my VB6 program to connect to a local MariaDB server using mysql-connector-odbc-5.3.6-win32.msi in Linux using wine. Now when I try to do the same, it fails:
Method '~' of object '~' failed
I wrote a minimal reproducible test case and I have great hopes that someone succeeds in getting the ADODB.Connection ".Open" call to succeed, and can steer me in the right direction.

Note: You do not need to have an actual MariaDB server running to test this. The challenge here is to get the "cn.Open" call to not fail with "Method '~' of object '~' failed". If whatever is causing this problem is solved, opening the connection if MariaDB is not running will fail with "[MySQL][ODBC 5.3(w) Driver]Can't connect to MySQL server on 'localhost' (10061)" which would be a tremendous success.

Step 1: Download winetricks:

Code: Select all

wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
Step 2: Download MySQL Connector ODBC:
https://downloads.mysql.com/archives/ge ... -win32.msi

Step 3: Set up a wine prefix:

Code: Select all

WINEARCH="win32" WINEPREFIX="$HOME/wine-ado" ./winetricks vb6run mdac28
WINEARCH="win32" WINEPREFIX="$HOME/wine-ado" wine msiexec /i mysql-connector-odbc-5.3.6-win32.msi
Step 4: Verify that MySQL Connector ODBC is available:

Code: Select all

WINEARCH="win32" WINEPREFIX="$HOME/wine-ado" wine control
See attached image "MySQL ODBC 5.3 Unicode Driver appears correctly".

Note that you do not have to create a new data source, it's enough that the MySQL ODBC 5.3 Unicode driver is visible there.
https://dev.mysql.com/doc/connector-odb ... t-dsn.html

Step 5: Download the source code/program:
https://filebin.net/vb1di59a65oxvsb1/ad ... t=icqv1naa
https://filebin.net/vb1di59a65oxvsb1/ad ... t=icqv1naa

I bundled two versions of the program; one uses late binding (Dim cn As Object), and the other uses early binding (Dim cn As ADODB.Connection) and as such has a reference to "Microsoft ActiveX Data Objects 2.8 Library" and the installer bundles MDAC_TYP.EXE

The zip files include compiled binaries, but you can compile yourself if you like.

Step 6: Run
Early-bound:

Code: Select all

WINEARCH="win32" WINEPREFIX="$HOME/wine-ado" wine adotest_early/bin/adotest_early.exe
Late-bound:

Code: Select all

WINEARCH="win32" WINEPREFIX="$HOME/wine-ado" wine adotest_late/bin/adotest_late.exe
Success would mean that you would either see the "OK" screen if your MariaDB server was up and running and your login credentials in the connection string were ok, or you would get a "Can't connect to MySQL server" popup if your server was not running.

See attached image "Success".

Failure would present itself as a "Method '~' of object '~' failed" popup.

See attached image "Failure".

I spent three days digging through the web, following dead links, dead ends and off-topic advice. I tried having the VB6 installer install MDAC_TYP.EXE, and having it not do that. I tried registering msado15.dll:

Code: Select all

WINEARCH="win32" WINEPREFIX="$HOME/wine-ado" wine regsvr32 /i msado15.dll
regsvr32: Successfully registered DLL 'msado15.dll'
regsvr32: 'DllInstall' not implemented in DLL 'msado15.dll'
Let me know if you get lucky, or if you know of any workarounds.
Attachments
fail.png
Failure
ok.png
Success
ok.png (4.66 KiB) Viewed 649 times
odbc.png
MySQL ODBC 5.3 Unicode Driver appears correctly

Post Reply