Running Visual Basic Database Appliation under Linux with WINE

I have a Visual Basic 6 program which connects to a MySQL database. I would like to run the executable on my Linux desktop, using WINE. So…here’s how to do it.

The Steps

  1. Install and configure a windows emulator to run windows executables under Linux.
  2. Install ActiveX controls within the windows environment
  3. Install the MySQL Connector on Linux through Wine
  4. Configure the ODBC connector.

Installing and Configuring the Windows Emulator
By and far the most popular windows emulator on Linux is WINE (www.winehq.org). Wine will allow Linux users to run Windows executables (.exe) files directly from within Linux. It is not a virtual machine nor is it Windows. Instead, it attempts to recreate the windows environment while translating the necessary instrunctions into a form Linux can handle so that the program can run properly.

Installing Wine is easy, depending on your system. For Redhat and Yum based systems, simply open a terminal in super user mode (or run as sudo) and type

# yum install wine

For Ubuntu and APT based systems, use

 # apt-get install wine

Once you have wine running, you can run executables by simply typing

 # wine example.exe

Installing ActiveX controls within the windows environment

To install ActiveX controls within Wine, you can use a script called “winetricks.” You can get winetricks by running the following command at the terminal:

$ wget http://www.kegel.com/wine/winetricks

Which will save winetricks to your current directory. Then run it by typing

$ sh winetricks

To install the necessary ActiveX data access components, simply type:

$ sh winetricks mdac28

Installing the MySQL Connector on Linux through Wine

There are a few things to keep in mind. First, you must install the MySQL ODBC data connector the same as you would on windows to let your program access the MySQL database. Also, becuase you will be running this through the windows emulator, you must install the Windows connector, not the Linux or Unix connector. For my project, I used the 3.51 ODBC Connector.

First Download the connector from
http://dev.mysql.com/get/Downloads/Connector-ODBC/3.51/mysql-connector-odbc-3.51.27-win32.zip/from/http://mysql.mirrors.pair.com/
Then run setup.exe by typing

$ wine setup.exe

This will install the MySQL ODBC connector piece for use within Wine.

Configuring the ODBC Connector

You must configure the ODBC datasource within Wine the same as you would within Windows. In Windows, you would simply go to Control Panel -> Administrative Tools -> Data Sources. To do this in wine, open your terminal and simply type

$ wine control

Set up the Data Source just as you would in Windows.

Leave a Reply

Your email address will not be published. Required fields are marked *