Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Connect VB6 To MySQL

Is there anyway to connect VB6 to MySQL server?? (I mean that to create an application which can insert data into mysql database)

Any idea?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
[MySQL][ODBC 3.51 Driver]Can't Connect To MySQL Server 10060
How to connect ODBC Driver with MySQL using dynamic IP internet connection in Visual Basic 6.0 application? I am getting error while connecting using [MySQL][ODBC 3.51 Driver] in Vb 6.0 application. I find that using static IP internet connection the application is working successfully but using dynamic IP internet connection occurs
error Description:-"[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server 10060"
and Error No:- "-2147467259". Actually we are using internet connection by "Tata Indicom internet service provider" and this is static IP internet connection and other connection is by "BSNL internet service provider" and this is dynamic IP internet connection.
Please help me as soon as possible.

Connect To Mysql With Mysql Parser?

I will connect with my application to mysql server to view
the information of the database.
I try to make a connection but unsuccesful.
I send a mail to my webhosting service and they
told me that they don't give the server permission to make
outside connections.
They say something about make connection with mysql php parser.

Can somebody tell me what this means and how it works??
Maybe give a small example?

Best regards, Peter B.

Connect To MySQL Without MYSQL Installed..?
Can I have a VB desktop app connect to a MYSQL database without MySQL being installed on that computer?  The MySQL data files for the DB will be on the machine though.

If not, what DB's other than Access can I do this for?

<-- JaeTech Solutions -->

Mysql Connect?
sConn = "Driver={mySQL};" & _
"Server=;" & _
"Option=16834;" & _

i try this to connect to mysql but its not i can connect locally to mysql? and what Option=16384 does?

How To Connect MySQL?
Hi! I'm working with MySQL and Visual Basic 6.0 using Adodc to connect. But I want to know if there is another way to connect, for example an object that works specially with Mysql and allows me to know if a field has the autonumeric property (for example).

Thanks everybody

VB Connect MySQL, Please Help!!!
Hi Everybody,

I am not a VB programmer and don't also want to learn it too much in depth, but right now I need to complete a small task. If somebody would be able to help me with using easy words, I would be Very Very Thankfull.
I have a very small project, 1 text box Name: "Text1" , one command button Name:"Command1" Caption:"Pin" and one command button Name:"Command2" Caption:"E&xit". Well, all that works in this project is the Exit button
All I want to do is that if I run this program, and click on the "Pin" button, it should display a pin-number inside the Textbox"Text1". The pin number is updated on a database on a remote server time to time. This database is at a domain that is registered with yahoo. All the configuration of mysql is as it is from yahoo by default. I am doing it right now with a php script. I can connect to database with php and get the pin No Problem there, but I want to use a simple exe file that my coleagues can use also later to do this task.
Here is my php code which I use to get the pins:
// Connect to the database server
$dbcnx = @mysql_connect("mysql",
"MyName", "MyPass");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
// Select the database
if (! @mysql_select_db("MyPin") ) {
echo( "<P>Unable to locate the MyPin" .
"database at this time.</P>" );
<P><center>Here are all the Pins in our database: </center></P>
// Request the text of all the Pins
$result = mysql_query(
"SELECT Pin FROM PinNumbers");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
// Display the text of each Pin
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["Pin"] . "</P>");
Ok, with this code I get the list of all pins and then select the most recent pin by myself. In my application I want to get just 1 recent pin, I gues I will be able to do that anyway myself too if I can get finished with the other stuff some how. I have downloaded some rtf tutorials also from this forum, downloaded also mysql-connector-odbc-3.51.12-win32 from MySQL site. I used VB Application Wizard also to conenct to my database, after going through all the steps when it finally asks me to give the connection details such as host, username and password etc, it gives me the following error when I enter the detail and try to connect "ODBC database open failed, check connect info". It attempted to connect at least a few times but right now it shows me this error as soon as I select MySQL 3.51 driver to connect without even ettempting to connect. PLEASSSSE HELP
I will be very Thankfull!!!!!!!!!

Can I Connect To A MySql Db?

How do we find out whether or not we can connect remotely to a MySql Db?

And if we can, well I've been trying to find out how to connect to one. I've searched the forum and most have said that it's the same as an ADO but the header/start is different. What is the difference?


Connect To Mysql In VB?
Im intermediate on both, but I have no clue as to how to connect to MYSQL with visual basic. I normally use php with it. I have it set up and it works fine with php so i just need to know how to connect to MYSQL.

VB Connect To MySQL
I have an mysql server running on my server.
is there any way to connect to it using vb 6?

i can't find anything usefull for vb 6.
to connect, and select a value from the database and put it into a variable.



Connect VB 6.0 To MySQL ??
hi all,
how to connect VB 6.0 to MySQL ? I have tried to find in internet, but i dont understand how they do it. I get an error...

did anybody know what is the simple sample code to connect to the MySQL Database?

Thanks in advance,


I Don't Know How To Connect Mysql Db
Hi I want to know how to use this connection string for mysql db connection. I already have a database name "hospital" in my mysql database. I don't know what to replace


Where can I get this from my system?


MyODBC 2.50 Local database:


MyODBC 2.50 Remote database:


MyODBC 3.51 Local database: (I use this connectionstring)

"DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=myDatabase;USER=myUsername;PASSWORD=myPassword;OPTION=3;"

MyODBC 3.51 Remote database:

"DRIVER={MySQL ODBC 3.51 Driver};;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;"

Connect To MySql (?)
Hi! Well, Im trying to connect to a remote mysql db. I found the code to conect, but i dont know wich library do I have to use... Do you guys know wich library do I have to use? I hope you can help me!


Connect With Mysql
How can I connect with MySql and manipulate information from there?

If its a control, what is the code for the manipulation?

EDIT: Thanks for the warm welcome

How To Connect With MySQL
how to connect with MySQL
somebody can help me, how to write the vb code to connect the mysql to be the backend database. can create table, fields


How To Connect VB With MySql
Hi ,
I would like to know how vb can be connected to MySql.I tried but didnt find any providers for MySql.Please help me

Connect MYSQL
How I connect MySql with VB6?

Connect To MySQL?
I use PHP+MySQL a lot... however, I'd like to try using VB + MySQL... I would assume that it is very similar... but maybe someone could provide the code to do basic MySQL actions through VB (I could probably figure out the rest), or maybe show me links to sample programs that use vb+mysql...

Thanks in advance!

VB Connect To MySQL DB?
Can VB/ADO connect to a MySQL database? If so what would the connection string be?


Vb Connect To MySQL
I never used MySQL or ODBC and I need instruction on how to setup VB to Query and retreive info from a MySQL DB? Any Help is Appriciated.

VB Connect To MySQL DB
How would I go about connecting to an online MySQL database on a server on the internet?

I would like to retrieve some values from it.


Connect VB To MySQL
Dear Friends

I want to use mysql at the back end with VB.

i have made a small program with microsoft ado 2.1 as reference. thecode
written in form1 is as follows:

Public cn As New ADODB.Connection

Option Explicit

Private Sub Command1_Click()

Dim rs As New ADODB.Recordset

rs.Open "CREATE DATABASE db_name", cn

End Sub

Private Sub Form_Load()

cn.Open "dsn=repmysqldsn;uid=;pwd=;"

End Sub

when i press command1 the vb generates an error "access denied for user:
@localhost' to database 'db_name'

the same error generates if i use shell prompt.

please help

Mohammad Haroon Naseer

Production Engineer

Flexible Packaging

Packages Limited

0300 43 13 430

How To Connect MySQL Db From Vb6
Hi can anybody help me connect MYSQL database with vb6 application using ADO.If you can please help.Your help will be highly appreciated


How Do I Connect To A MySql DB?

I'm very new to sql databases and the like and i'm trying to work out the basics.
all i need to know is just how to make a form that can enter data into an sql database on Mysql server running on my pc. Also how to read it etc.

I'm trying to use the below code to connect to my DB on my pc, but for somereason its ion the wrong format, my guees is the Jet format, but i'm not sure how to change it.

Can anyone help me?


My code is as below

lblstatus.Caption = "Connecting ........."
Dim DataBaseName As String
Dim DataBasePath As String
Dim strConnecting As String
DataBaseName = "adverts.myi"
'DataBasePath = App.Path & "" & DataBaseName
DataBasePath = "C:Mysqldata est" & DataBaseName
strConnecting = "Provider=Microsoft.Jet.OLEDB.4.0" _
                & ";Data Source=" & DataBasePath _
                & ";Persist Security Info=False"
dbCon.ConnectionString = strConnecting
lblstatus.Caption = "Connecting"

Can't Connect To MySQL
I can't connect to MySQL. Any explanation on this one. I use MYSQL ODBC 3.51 driver to try connect to the Server. I try to connect on the localmachine. Is is not possible to connect to the localhost using MySQL. I am new to this one.

Private Sub Command1_Click()
    Dim conn As ADODB.Connection
    Set conn = New ADODB.Connection
    conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=;Database=dfamily;UID=jered;PWD=virtueson"
    If conn.State = adStateClosed Then
        If conn.stat4e = adStateOpen Then
            MsgBox "Connection Open"
        End If
    End If
End Sub
MySQL Information

Connect To MySQL DB With VB
Hi everyone, I'm having some problems connecting to a online MySQL DB. I'm still very new to DB's. Anyway, here's my problem:

I have some code I found while googling on the web, it's working with MySQL Connector NET 1.0.9, when I click the button to connect to the DB after a long time it gives this error:

"Unable to connect to any of the specified MySQL hosts."

Heres my code:

Imports MySql.Data.MySqlClient

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myConnection As New MySqlConnection()
        myConnection.ConnectionString = "Persist Security Info=False;database=jgodinho;;Connect Timeout=30;user id=jgodinho; pwd=....."

            MessageBox.Show("Connection Opened Successfully")


        Catch myerror As MySqlException
            MessageBox.Show("Error Connecting to Database: " & myerror.Message)
        End Try
    End Sub


VB6 Connect To MySQL

I've an error connecting to MySQL through client PC through VB6 application.

MySQL installed on the server (windows XP).
VB Application is installed on Client PC (windows XP).

My code to connect:

db.CursorLocation = adUseClient

db.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=chard;" _
            & "DATABASE=test;OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841 & ";" _
            & "UID=root; pwd=xxxx;"

From some reading, it's recomend to switch off the Win XP Firewall.

After that, I've installed the VB programm at server itself, but unfortunately its also cannot be connected. Unless I change "SERVER=localhost" or using "SERVER=".

Can anyone help me? or provide me with any link regarding this matter.
Thanks in advance.

Connect To MySQL On An ISP?
I'm trying to plan out a project where a client application (in .net) can query data on a web server. The server is mySQL on an ISP machine, but it doesn't allow ODBC - and that's the problem.

Can someone give me some suggestions, or where to look for options?


Connect From VB To MySQL Without ODBC
Hello! i am writting a game server and my plan is to make it to put the number of players online in a mysql database for showing it on a website after and probably on the client.. but i need a way to connect on mysql without the need to install ODBC drivers..


Connect To Mysql Database?
I am trying to connect to mysql database from VB6
I have installed drivers etc...
Setup is on jpg file and error also

Any ideas on connection error??

Any help appreciated...

cnn1.ConnectionString = "driver={MySQL};" & _
"server=;uid=webmaster;pwd=secret;" & _

Connect To Mysql Database
hello everyone,
i have a mysql database on a free hosting site. this is it has just one table in it. i want to know if it is possible to connect to this database and then retrieve data from the table using visual basic.

i want to populate a list box with the data in the table.

can anyone help.

thanks a lot

Trying To Connect To A MySQL Database
Hi all, im trying to connect to a MySQL database and i am using


But everytime i try to connect i get the error:
"[Microsoft][ODBC Driver Manager] Data source not found and no default device driver specified"

Has anybody got any ideas why?

P.S. I have also tried all of the suggestions on this page

Trying To Connect VB6 To Remote MySQL

I'm about pulling my hair out trying to perform the above. I get the error

[Microsoft][ODBC Driver Manager] Data source not found and no default driver specified

Here's the code

Private Sub Command1_Click()
conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};;DATABASE=mydb;USER=a;PASSWORD=b;OPTION=3;"

End Sub
Real connection details obviously removed.

I have the following references enabled

VB for applications
VB runtime objects and procedures
VB objects and procedures
OLE automation
Microsoft active data objects 2.8 libray
Microsoft remove data object 2.0

Any help GREATLY appreciated!


App To Connect To MySQL Database
ok, i'm in the process of setting up a site which runs as a sort of competition between users to accumulate points by various programming challenges. I want to make an app in VB that connects to my mySQL database to read scores, update rankings etc. I just wondered what the best method of connecting would be?

Connect To Mysql Server With ADO In VB
Trying to connect to a Unix server running Mysql from VB 6. I continue to get error -2147467259 connection lost error when trying to add new records.
I can connect with ftp fine and connect to my local test enviornment with these settings, but not able to connect to the server. Any suggestions on the connection string below or other possibilities. The error occurs at Thanks.

Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

conn.CursorLocation = adUseClient

conn.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};" & _
"Server=" & Server.Text & ";" & _
"Port=" & Port.Text & ";" & _
"Database=" & DB.Text & ";" & _
"Uid=" & UID.Text & ";" & _
"Pwd=" & Pass.Text & ";" & _
"Option=1 2 8 32 2048 16384;" '131072


VB Connect To MySQL Over Network
I plan to develop an application as followings:
Front-end: VB 6
Back-end: MySQL Server
Access: on LAN
Description: Data stores in mySQL on one computer (server) and other computers (clients) connect to the server and get data.
Problems: I don't know how to query and get result from query over network. And I don't know how to transfer image files (occasionally). As I have searched the web and found some ideas. It uses WinSock to send data, only in string.
Question: Is there any way else to transfer data in recordset or anything easy to parse the result? Is using WinSock the fastest way?
Please help give me the ideas or solutions.
Thanks in advance.

How To Connect VB6 App To MySQL Database ?
HI !!!!

I've been working with "Access" as my Database manager and accessing it from VB6. I want to migrate the "Access" database to "MySQL" and I'd like to know: 1) How to connect to a "MySQL" database from BV6; 2) Do I have to change the code of the queries I've already written for "Access" ?; 3) Do I need another program like the MySQL Administrator or something like this ?; 4) What problems could all this process bring ?

Thanks !!!

Other Than Using MyODBC, Is There Any Way To Connect Vb To Mysql?
Hi.. I just want to know, is there any other way to connect vb to mysql? Instead of using myodbc?

Connect And Read From MySQL?
I was wondering how i would go about reading from a MySQL database? thanks for the startup

Connect To MySQL Database
ok i need my app to connect to a database and check a field to see if there is a update avalible, any help?

How Can I Connect To MySQL Database?
What way that I can connect to MySQL database by use VB6?

MySQl Connect And Search
Alright guys, another day another task. I've got a MySQl database on a 2000 server that we curently connect to, using php and fox pro. In the database there is a table containing the username and password of all the users on the system. What i need is to be able to connect to the database serach for a user by the name they enter search for name and verify the password they entered against the one that they entered. Any help with this would be much appreciated.


Program Can't Connect To MySQL
Hey guys, I'm writing a program that needs to connect to a mySQL data base and it won't becuase my firewall on my router is blocking the port!!!! How do I stop this?

How To Connect Database In MySQL To VB6?
im new to database stuffs, so may i know how to connect to mySQL database using VB6? detailed steps required, thx a lot

Connect To Mysql Server
Maybe a dumb question, but I couldn't find it in the forum. I'm looking for a simple script to get information out or into a mysql database.

I've got a program that is now sending an php-post with arguments, to a website, that website is parsing the arguments into my database. And to get information, the program is opening a php-page with arguments. The website is parsing the information in lines on the webpage. And with the command: webbrowser1.document.body.innertext and the split command i'm receiving the information.

Are u still there???

Yes indeed, i'm looking for a simple method to do this, just to enter or get a few argument out of the database.
Has someone a little example for me?

Just for the information: I'ts a MySql database, not a MSSQL

In forward, thanx

Edited by - mrsrieu on 4/20/2004 1:57:54 PM

Connect To MySQL Server
I need to connect to a MySQL database, but am having problems. (I am writing code in .aspx files on my host's server).

What should the connection string look like?


Connect To Mysql Database
I need to code for connecting to a online mysql database.
i tried some stuff from but that only gave me errors..
Anyone here who can help me with this?

Connect With MYSQL Database!
Hi friends,
Can i connect Visual Basic program with MYSQL database?
Please reply!

Copyright 2005-08, All rights reserved