Open ADODB connection in wine using mysql-connector-odbc

Questions about Wine on Linux
Locked
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 »

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
Failure
Failure
Success
Success
ok.png (4.66 KiB) Viewed 8910 times
MySQL ODBC 5.3 Unicode Driver appears correctly
MySQL ODBC 5.3 Unicode Driver appears correctly
jlncrnt
Newbie
Newbie
Posts: 1
Joined: Mon Mar 23, 2020 8:09 am

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by jlncrnt »

Hello,

I have a very similar problem that I'm struggling to fix. I'm trying to connect to a server with Sparx Enterprise Architect. I can run a "Test connection" which works in Sparx EA, but I get the following error in wine logs each time I try to access the server:

005c:fixme:msado15:connection_put_ConnectionString 135605E8, L"Provider=MSDASQL.1;Persist Security Info=False;User ID=<myid>;Data Source=PostgreSQL35W"
005c:fixme:msado15:supporterror_InterfaceSupportsErrorInfo 135605E8, {00000550-0000-0010-8000-00aa006d2ea4}

I have wine 5.0 with mdac28 installed, and PostgreSQL driver installed with the msi installer. I can see the data source with `wine control` and I have a working connection test through Sparx EA, but retrieving the data seem to fail when I save the server config.

Any idea ?
rmkk
Level 2
Level 2
Posts: 12
Joined: Tue Dec 03, 2019 5:24 am

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by rmkk »

I had the same problem on wine-5.2 (Staging). So I tried wine-4.0.3 (Stable) a there it work fine fortunately.
0xedd
Newbie
Newbie
Posts: 1
Joined: Thu Apr 02, 2020 1:38 pm

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by 0xedd »

rmkk wrote: Thu Apr 02, 2020 8:45 am I had the same problem on wine-5.2 (Staging). So I tried wine-4.0.3 (Stable) a there it work fine fortunately.
Thank you! I was trying to install BioEdit that uses the same library and this was the final fix.
Hambert
Level 2
Level 2
Posts: 11
Joined: Tue May 05, 2020 4:09 pm

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by Hambert »

0xedd wrote: Thu Apr 02, 2020 1:49 pm
rmkk wrote: Thu Apr 02, 2020 8:45 am I had the same problem on wine-5.2 (Staging). So I tried wine-4.0.3 (Stable) a there it work fine fortunately.
Thank you! I was trying to install BioEdit that uses the same library and this was the final fix.
Thank you both! Thank god I came across this thread. I was also trying to make a program run on Debian and it would complain about the

Code: Select all

msado15.dll
library as the software tried to access databases despite having Jet40 already installed wit Winetricks. It only worked on Wine 4.0! I was using latest version 5 with no luck.

I'm a noob on Linux and the software I installed is a control program for a lab autoanalizer, it stores all the data in databases.

How can we report this bug so it gets fixed? It was a pain in the a** figuring it out and I can only imagine the amount of noobs like me that have already given up on using Wine after things like these.

Thank you!!
dacha
Level 1
Level 1
Posts: 6
Joined: Sun May 24, 2020 3:22 am

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by dacha »

Merlot wrote: Fri Nov 30, 2018 11:24 am Step 5: Download the source code/program:
https://filebin.net/vb1di59a65oxvsb1/ad ... t=icqv1naa
https://filebin.net/vb1di59a65oxvsb1/ad ... t=icqv1naa
Hi

I'd like to try fix this, but these links don't exist any more, please upload them again.
Hambert
Level 2
Level 2
Posts: 11
Joined: Tue May 05, 2020 4:09 pm

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by Hambert »

dacha wrote: Sun May 24, 2020 4:12 am
Merlot wrote: Fri Nov 30, 2018 11:24 am Step 5: Download the source code/program:
https://filebin.net/vb1di59a65oxvsb1/ad ... t=icqv1naa
https://filebin.net/vb1di59a65oxvsb1/ad ... t=icqv1naa
Hi

I'd like to try fix this, but these links don't exist any more, please upload them again.
I could provide a working copy of the software I´m using to control a laboratory autoanalizer, under wine 5.0 it won't connect to the database and refuses to start right after the authentication screen with a DB error. If it's of any use please let me know and I'll upload it.
dacha
Level 1
Level 1
Posts: 6
Joined: Sun May 24, 2020 3:22 am

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by dacha »

Hambert wrote: Sun May 24, 2020 4:41 pm I could provide a working copy of the software I´m using to control a laboratory autoanalizer, under wine 5.0 it won't connect to the database and refuses to start right after the authentication screen with a DB error. If it's of any use please let me know and I'll upload it.
Sure, let's see it.

Please also describe how to run it.
Hambert
Level 2
Level 2
Posts: 11
Joined: Tue May 05, 2020 4:09 pm

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by Hambert »

dacha wrote: Mon May 25, 2020 8:24 am Sure, let's see it.

Please also describe how to run it.
Ok!

First of all, here's a link to my OneDrive folder containing the files. "BS120.zip" contains a copy of the installation folder as it was used in the lab, it should be portable and ready to run. In case you need the installer, it's in the other .zip named "BS-120_Operation Software[...].zip".

Using the portable folder as an example, launch the program using BS120.exe. I don't remember well if the DB error came before or right after the login prompt. In any case, the user and password is
admin Admin
respectively (please note the uppercase A in the password is needed).

If the program can connect to the database successfully, it will go on and try to connect to the autoanalyzer via a COM port. At this point you can say it's working. Otherwise it would complain about the DB (or BD in spanish) and exit. The dll Wine debug error will be shown in terminal.

Note that many other libraries are needed for it to run, I installed them using the latest Winetricks.

Hope you can find a fix, there are some other bugs in Wine 4.0 that I would like to see if they're fixed in 5.0! I would like to try it out.

If I can help with anything else, please ask me. Thank you so much!
spoon0042
Level 6
Level 6
Posts: 570
Joined: Thu Dec 24, 2009 11:00 am

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by spoon0042 »

Hambert wrote: Mon May 25, 2020 9:57 am Ok!

First of all, here's a link to my OneDrive folder containing the files. "BS120.zip" contains a copy of the installation folder as it was used in the lab, it should be portable and ready to run. In case you need the installer, it's in the other .zip named "BS-120_Operation Software[...].zip".

...
So I took a look at this. I think the main issue is in 5.0 wine started to implement msado15.dll. Unfortunately not much has been done yet, like connection_Open isn't implemented at all.

Good news though is I think I got the db to connect on 5.9 devel. Made a 32-bit prefix (64-bit may work or maybe not). Then 'winetricks jet40 mfc42 mfc80'. Which *almost* gets things working. Problem is winetricks doesn't override msado15.dll with wine 5.x (because 5.x has a builtin version) so you have to manually add it in winecfg.

Hopefully that gets things working for you. There still may be a bug worth reporting here, whether in wine or winetricks or both. But I may be getting ahead of myself. :)
spoon0042
Level 6
Level 6
Posts: 570
Joined: Thu Dec 24, 2009 11:00 am

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by spoon0042 »

Actually it looks like a bug in winetricks since it *should* be adding that override. I think.
Hambert
Level 2
Level 2
Posts: 11
Joined: Tue May 05, 2020 4:09 pm

Re: Open ADODB connection in wine using mysql-connector-odbc

Post by Hambert »

spoon0042 wrote: Tue Jun 02, 2020 2:13 pm So I took a look at this. I think the main issue is in 5.0 wine started to implement msado15.dll. Unfortunately not much has been done yet, like connection_Open isn't implemented at all.

Good news though is I think I got the db to connect on 5.9 devel. Made a 32-bit prefix (64-bit may work or maybe not). Then 'winetricks jet40 mfc42 mfc80'. Which *almost* gets things working. Problem is winetricks doesn't override msado15.dll with wine 5.x (because 5.x has a builtin version) so you have to manually add it in winecfg.

Hopefully that gets things working for you. There still may be a bug worth reporting here, whether in wine or winetricks or both. But I may be getting ahead of myself. :)
I can't thank you enough. I'm a noob on Linux and I'm slowly learning how Wine works. Good news is I can now test the software in newer versions of Wine with your method. Bad news is another bug I wanted to test is still present, so I guess I'll have to file a report for that.

Thank you so much!! :D :D
Locked