Accessing remote MySQL DBs in VB6

MySQL expert Scott Noyes recommends downloading ODBC to connect within your VB project.

I'm looking for a way to access and control remote MySQL DBs in VB6 using either sockets or a free VB control. Do you have any examples of how to manipulate them?

MySQL supports ODBC. Download the ODBC drivers. In your VB project, add the Microsoft Remote Data Object and connect.

Your connection code might look something like this:

Dim cnMySql As New rdoConnection
cnMySql.CursorDriver = rdUseOdbc
cnMySql.Connect = "DRIVER={MySQL ODBC 3.51 Driver};" & _
 "SERVER=yourHostName;PORT=3306;" & _
 "DATABASE=dbName;" & _
 "UID=yourUserName;PWD=yourPassword;" & _
Check the values for the OPTION parameter.
This was first published in September 2006

Dig deeper on Open source databases

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: