Solved

MySQL VB ADO connection with mySQLProv

Posted on 2004-10-14
13
3,556 Views
Last Modified: 2013-12-25
I have developed a program in VB6 connecting to an SQL server using ADO and the OLEDB provider. Now I want connect to a mySQL server. The only option next to using ODBC is by my knowledge mySQLProv. I have 2 problems with this provider:
1) When I use the connection.Open with the following connection string (or any other):
         connection.Open "Provider= mysqlprov;" & _
             "Server = Localhost" & _
             "DataBase= myDB;" & _
             "Uid = myUser;Pwd = myPW;"
 I get a popup screen "MySQL data source Name Set up" where I have to fill in the same data. Is there any way around this?

2) When I fill the data I am able to connect to the database but I am getting some problems with SQL statements that do work in mySQL directly but not via the connection:
a) tablenames longer than 19 characters generate an error
b) JOIN expressions do not seem to work?
Can anybody shed some light on this?
Thanks in advance,
Jurriaan
0
Comment
Question by:J_code
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
13 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 12308997
Try this:

oConn.Open "Provider=MySQLProv;" & _
           "Data Source=mySQLDB;" & _
           "User Id=myUsername;" & _
           "Password=myPassword"

and take a look here:

http://www.coveryourasp.com/Snippet.asp?snip=16

Leon
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 12309008
MySQL Reference Manual:

http://dev.mysql.com/doc/mysql/en/index.html

Leon
0
 

Author Comment

by:J_code
ID: 12316439
Still getting the popup screen. I have tried several connection strings, when I enter a datasource the fields 'datasource' and 'Database' are filled with the data source name (see code below), otherwise fields are empty.
         connTraceLab.Open "Provider= MySQLProv.2.5;" & _
             "Server = Localhost; Data Source = myDB;" & _
            "DataBase= myDB;" & _
             "User Id = myUser;Password = myPWD;"


The reference manual doesn't really answer my questions. There is no mention of mySQLProv and the only reference to OLEDB is: "If you have problem with MyODBC and your program also works with OLEDB, you should try the OLEDB driver. "

It is important for me to know whether 'JOIN' expressions can be used with mySQLProv, if this is not possible I can quit this exercise...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
samtyf earned 250 total points
ID: 12317382
Why not have a try on the MySQL ODBC Connector 3.51? Download it from here

http://dev.mysql.com/downloads/connector/odbc/3.51.html

The code in VB is

Connection.Open "Driver={MySQL ODBC 3.51 Driver};Server=10.10.10.10;uid=userid;pwd=userpasswd;database=databasename"

Regards,
Sam Tan
0
 

Author Comment

by:J_code
ID: 12317559
Thanks Sam, however I am not so keen on using ODBC for a multi user environment..

Anyway I found a new version of myOLEDB (mysqlprov 3.0) which solves part 2 of the problems mentioned above. JOIN and tablename length are no longer a problem!

The pop up screen still appears when connecting however. It seems I am not able to fill the mySQL host from the connection string (Username and password are filled now and as dataSource '[Default]' is entered). Any suggestions?

Jurriaan

0
 

Author Comment

by:J_code
ID: 12317613
Problem solved!
The following connection string worked:
         conn.Open "Provider= MySQLProv.3.0;" & _
             "Data Source = myDB; " & _
             "Database = myDB;" & _
             "User Id = myUser;Password = myPW; option = 3"
Thanks for helping.
Jurriaan
0
 

Author Comment

by:J_code
ID: 12320385
It turns out that the myOLEDB is not so useful for me after all. Transactions and single row locking are not supported and apparently the myOLEDB is no longer in development (see
http://www.experts-exchange.com/Databases/Mysql/Q_20732567.html)

So I will go with Sams' suggestion and try the myODBC. One question though. Do you have to install myODBC.exe on each client or can you just use a dll?

J.
0
 

Expert Comment

by:samtyf
ID: 12326386
Hi Jurriaan

So far, i'm installing the myODBC in each client machine. But i'm not sure it can or cannot to just use a dll without the myODBC Installation. :)

Regards,
Sam Tan
0
 

Author Comment

by:J_code
ID: 12816899
OK, since I am using the myODBC I'll award Sam with the points.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 12822931
To do that, click the "Accept" button next to his post.  Thanks. -- Dan
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 12830033
DanRollins,

I am assuming you are taking care of this.

Leon
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month5 days, 17 hours left to enroll

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question