How to use Visual Basic to connect to MySQL

From DreamHost
Jump to: navigation, search

This topic deserves a step by step as it seems it would be a common need. In any event I just went through the steps so here they are. I am working from memory so I may miss a few details here and there. Either ping me or write in the added detail yourself -- google->embeddedrf

Initial conditions: I run windows 98 and have an MySQL database on DreamHost and want to connect with Visual Basic
Debug Sequence used: I used 3 separate VB source codes from Various problems were solved during play with each sequential script. I will give you my best guess with regards which did what.

Because I use Windows 98 I had to get and updated version of msado26.tlb
I found that if I downloaded their MDAC 2.8 update that it had what I needed. --I did this by going to:
Here I could see that it had msodo26.tlb
--Then I went here and read more
--The finally to download this from:
I installed this update from Microsoft. When I check the directory I could see:
C:\program files\common files\system\ado\msado26.tlb
Missing tlb file solved.
First VB app from Planet Source Code run: LearnMySQL
When I tried to run this code it flagged the most common error according to Microsoft.
Microsoft OLE DB Provider for ODBC Drivers error 80004005 [Microsoft][ODBC Driver Manager]Data source name not found and no default driver specified.
You can read about this a solution:
While this made it evident that there was trouble with the registry settings its terminology was ambiguous so I looked for another option. Something needed set in the registry. I viewed some of the relevant keys. Rather than edit by hand guessing at the ambiguous terminology in the naming of keys I used another downloaded VB code. This code is described as follows: Allows you to programmatically create an ODBC connection to a MySQL database using the Registry API.
I ran it and set the relevant quantities: My SQL server,MySQL ID,Password,MySQL password, MySQL Database Name and the rest I left alone hoping for the default settings to work.
Next I downloaded and installed the MyODBC3.51 driver from
After that I was flagged an error that seemed like it did not like my login password. This is the error flagged:
A MySQL Connection Error has been returned:[MySQL][ODBC 3.51 Driver]Access denied for user embeddedrf@ip67-4-162-63(using password:YES)[-2147468259]

This is because DreamHost requires you set up the IP address the user will work from in the WebPanel interface. Do this and it works finally !