|
-
Jul 9th, 2012, 11:58 AM
#1
Thread Starter
New Member
Connecting to MySQL from ADO in VB
I am trying to connect to an online MySQL database from VB6 using ADO
and I'm getting the following error. "data source name not found and no default driver specified"
here's the code I'm using to try to connect.
Code:
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
connectionstring = "Driver={MySQL ODBC 5.1 Driver};Data Source=URL,3306;Database=DBNAME;User=USERID; Password=PASS;Option=3;"
conn.Open connectionstring
rs.Open "SELECT * FROM card_prices", conn
no doubt its simply my inexperience with this type of connection. I have plenty of experience with MySQL but none with these connection string jiggys.
P.S. I've tried downloading the MySQL ODBC 5.1 Driver and installed it but no effect. Do I have to install the version matching my system or the one matching the server?
Last edited by markmercer; Jul 9th, 2012 at 02:46 PM.
-
Jul 9th, 2012, 12:02 PM
#2
Re: Connecting to MySQL from ADO in VB
http://www.connectionstrings.com/mysql
It's uid and pwd.... not User and Password....
-tg
-
Jul 9th, 2012, 12:49 PM
#3
Thread Starter
New Member
Re: Connecting to MySQL from ADO in VB
that's irrelevant. I've tried it both ways, same error.
http://www.connectionstrings.com/mysql#p31
the error i'm getting is not to do with those fields.
-
Jul 9th, 2012, 01:10 PM
#4
Re: Connecting to MySQL from ADO in VB
 Originally Posted by markmercer
P.S. I've tried downloading the MySQL ODBC 5.1 Driver and installed it but no effect. Do I have to install the version matching my system or the one matching the server?
The driver on your machine must match what you are using in your connection string.
-
Jul 9th, 2012, 02:45 PM
#5
Thread Starter
New Member
Re: Connecting to MySQL from ADO in VB
ok thats the one I have installed
-
Jul 9th, 2012, 03:07 PM
#6
Re: Connecting to MySQL from ADO in VB
 Originally Posted by markmercer
If you look at the strings at that link none of them match what you have
you have Data Source= where they all use Server= instead
-
Jul 10th, 2012, 06:02 AM
#7
Thread Starter
New Member
Re: Connecting to MySQL from ADO in VB
 Originally Posted by DataMiser
If you look at the strings at that link none of them match what you have
you have Data Source= where they all use Server= instead
well your right.
I HAD used examples directly off that site but that was before I installed the driver. now I have tried this one:
Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
and I get a different error (to me that means I'm making progress).
the error is "Can't connect to MySQL server on myServerAddress"
I wonder if I have to submit an address other than the root domain. Have any of you guys ever done this with a domain managed by Cpanel?
Last edited by markmercer; Jul 10th, 2012 at 06:10 AM.
-
Jul 10th, 2012, 07:31 AM
#8
Re: Connecting to MySQL from ADO in VB
So you're trying to access a mySQL database that is on a web server somewhere? That presents a whole new set of problems. You';ll need to check with the host... a lot of them (if they are any good) only make their databases available from within their domain... and not directly accessable to the outside world. If that's the case, then you'll need create something that acts as a web service and can be put onto the webserver, take requests, and return data.
-tg
-
Jul 10th, 2012, 11:26 AM
#9
Thread Starter
New Member
Re: Connecting to MySQL from ADO in VB
I am a web developer, and I've been using this host for many years now. I know that the server will allow incoming connections because in the past I've opened a connection to it from another site. But I wouldn't be surprised if it was still some configuration thing that's interfering.
I've been talking to the host (as i know him personally) but its hard to find answers when you don't know what questions to ask. I'll contact him again and see what else we can try.
Perhapse from here on out the answer lies between me and his configuration.
Still if there's any more advice you guys can offer, please post.
Thanks.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|