none
OLEDB provider for MySql RRS feed

  • Question

  •  

    Hi,

    I'm trying to implement a application (in C# dotnet) where i can import data from any database. I need to support SQL Server, MS Access, MySQL, DB2, Oracle and all.

    Now I'm using a ADODB._Connection object and calling its .PromptNew() method to call the Data Link Properties dialog where user can select the required provider, the server, enter user id and passowrd. The Data Link Properties dialog returns a ADODB connection object. I take the connection string from this object and create my Oledb connection object with the same sonnection string. Using this oledb connection object I'm able to connect to SQL Server and MS Access databases and retrieve data.
    But I'm facing problem with MySQL database. For MySQL database the connection string I get is the following.

    "Provider=MSDASQL.1;Persist Security Info=False;User ID=root;Data Source=test2;Initial Catalog=mysql"

    But Oledb connection object does not support MSDASQL. Please help me out.

    Thanks in advance for you help.

    Monday, February 23, 2009 12:50 PM

All replies

  • Don't you need to specify the ODBC driver you are using in the connection string? What you're actually using is the generic OLEDB to ODBC bridge and not the native OLEDB driver for MySQL. See below: 

    http://www.sqlstrings.com/MySQL-connection-strings.htm


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, February 23, 2009 3:53 PM
  • I would recommend using DatabaseFactory from .NET that allows to abstract database-specific functionality, or, at least, create your own factory if .NET factory does not work for you. Using COM-based ADO in .NET is not the best solution.


    Val Mazur (MVP) http://www.xporttools.net
    Thursday, February 26, 2009 11:23 AM
    Moderator