Connect to MySQL via ADO

rsaritzky
Member Posts: 469
Hi,
I’m trying to connect from NAV2009 to a MySQL database. I’ve installed the MySQL ODBC driver and also the MySQL Connector/NET driver.
The ODBC connection works successfully when I use the following connection string (assigned to a variable of type 'Microsoft ActiveX Data Objects 2.8 Library'.Connection):
However, I’d like to connect via Connector/Net. I’ve tried the following connection string:
However, I get an error from NAV when this is run:
Microsoft Dynamics NAV Classic
This message is for C/AL programmers: The call to member Open failed. ADODB.Connection returned the following message: Provider cannot be found. It may not be properly installed.
I've verified that MySQL Connector/NET has been installed. All the examples indicate that the Provider Name is supposed to be "MySQLProv", but I don't know if there's a way to verify that. I'm using MySQL Connector/Net 6.4
Has anyone done this and been successful?
Thanks
Ron
I’m trying to connect from NAV2009 to a MySQL database. I’ve installed the MySQL ODBC driver and also the MySQL Connector/NET driver.
The ODBC connection works successfully when I use the following connection string (assigned to a variable of type 'Microsoft ActiveX Data Objects 2.8 Library'.Connection):
ADOConnection.ConnectionString('Driver={MySQL ODBC 5.1 Driver}; server=127.0.0.1;PORT=3306;database=testdb;User=navread;Password=navreadpwd');
However, I’d like to connect via Connector/Net. I’ve tried the following connection string:
ADOConnection.ConnectionString('Provider=MySQLProv;Data Source=localhost;Initial Catalog=testdb;User ID=navread;Password=navreadpwd;');
However, I get an error from NAV when this is run:
Microsoft Dynamics NAV Classic
This message is for C/AL programmers: The call to member Open failed. ADODB.Connection returned the following message: Provider cannot be found. It may not be properly installed.
I've verified that MySQL Connector/NET has been installed. All the examples indicate that the Provider Name is supposed to be "MySQLProv", but I don't know if there's a way to verify that. I'm using MySQL Connector/Net 6.4
Has anyone done this and been successful?
Thanks
Ron
Ron
0
Comments
-
Hi,
Have you installed MDAC latest version on machine?Anil Kumar Korada
Technical Consultant0 -
anilkumar wrote:Have you installed MDAC latest version on machine?
The version of MDAC is 2.8.1132, which I'm reasonably certain is 2.8 SP1, the latest version of MDAC. I didn't think that MDAC has changed in the last few years - the Microsoft Download site says that MDAC 2.8 was released in 2005, so I'm assuming that the current install is the latest. But I will try to verify that 2.8 SP1 is 2.8.1132.
RonRon0 -
I've had problems with providing NAV access to MySQL with ADO in the past. One of the problems I experienced is that when you make a connection to MySQL it's all wrapped up in the transaction that NAV has started and the MySQL ADO implementation does not fullly support distributed transactions. Because NAV has started the transaction MDAC and the ADO connection are trying to keep everything flowing within the context of the transaction that was started within NAV and an error is raised.
Just something to watch out for.0 -
Thanks for the advice. The process flow for me is pretty simple - do a SELECT and dump the data into a NAV table, so I'm not too concerned - just how to construct the connection string to attach to the database...Ron0
-
Hey Ron,
Any luck with that error?
"Provider cannot be found. It may not be properly installed."
I'm getting the same thing...0 -
DigiTecKid wrote:Hey Ron,
Any luck with that error?
"Provider cannot be found. It may not be properly installed."
I'm getting the same thing...
I ended up going with the ODBC connector - it's been working fine for more than a year.
However, if you want to try some other strings, here's some from a great website I found: http://www.connectionstrings.com - it has sample connection strings with dozens of optional parameters. If you want to get into some esoteric combinations, try that website - it has strings for MySQL, SQLServer, Oracle, Sybase, DB2 and others.
Standard
Server=testserver;Database=dbtest;Uid=userid;Pwd=userpwd;
Specifying TCP port
Server=testserver;Port=3306;Database=dbtest;Uid=userid;Pwd=userpwd;
Good luck!
RonRon0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions