Problems with MysqlDirect.Net and Vs2005 Beta 2

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
J van Dorsten

Problems with MysqlDirect.Net and Vs2005 Beta 2

Post by J van Dorsten » Wed 01 Jun 2005 08:09

Hello,

I am evaluating MySQLDirect .NET version 2.80.7.0, and i am trying to get it working in VS2005 Beta 2.
We want to use Jet, Sql and Mysql and want to use the DbProviderFactories from .Net 2.0.

I got a mail from your support desk wich advised me to change machine.config and add the following line in

Code: Select all

      
Then i added a reference to MySqlDirect 2.80.7.0.

I have the following relevant code

Code: Select all

    Private Const conProviderNameSpaceSQL As String = "System.Data.SqlClient"
    Private Const conProviderNameSpaceJET As String = "System.Data.OleDb"
    Private Const conProviderNameSpaceMySQL As String = "CoreLab.MySql"

    Private varDbDataFactory As DbProviderFactory   
    Private varDbConnection As DbConnection         

      Select Case parServerReferentie.prpDbTypeGet
        Case intDbcServerReferentie.enmDbType.encDbJet
          varDbDataFactory = DbProviderFactories.GetFactory(conProviderNameSpaceJET)
        Case intDbcServerReferentie.enmDbType.encDbMySql
          varDbDataFactory = DbProviderFactories.GetFactory(conProviderNameSpaceMySQL)
        Case intDbcServerReferentie.enmDbType.encDbSql
          varDbDataFactory = DbProviderFactories.GetFactory(conProviderNameSpaceSQL)
      End Select
When i execute the code it returns the following error:
System.InvalidOperationException: The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type..
CoreLab.MySql.MySqlDirectFactory inherits from CoreLab.Common and not System.Data.Common!

This is the Stack Trace from the error:

Code: Select all

    at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at SnelStart.nspData.clsDbcConnection..ctor(intDbcServerReferentie parServerReferentie, intDbcDatabaseReferentie parDatabaseReferentie)
   at tpnDbConnection.testDbConnection.TestConnectieMySqlOpen()
Any ideas or other solutions?

Regards.

Serious

Post by Serious » Wed 01 Jun 2005 09:48

MySQLDirect .NET version 2.80 for .NET Framework 1.x is not compatible with .NET Framework 2.0

You can download MySQLDirect .NET trial version 2.80 for .NET Framework 2.0 here

J van Dorsten

Post by J van Dorsten » Wed 01 Jun 2005 10:10

Ah yes, thank you very much, it works now.

dohymion
Posts: 1
Joined: Fri 30 Dec 2005 13:42

Re: Problems with MysqlDirect.Net and Vs2005 Beta 2

Post by dohymion » Fri 30 Dec 2005 13:43

J van Dorsten wrote:Hello,

I am evaluating MySQLDirect .NET version 2.80.7.0, and i am trying to get it working in VS2005 Beta 2.
We want to use Jet, Sql and Mysql and want to use the DbProviderFactories from .Net 2.0.

I got a mail from your support desk wich advised me to change machine.config and add the following line in

Code: Select all

      
Then i added a reference to MySqlDirect 2.80.7.0.

I have the following relevant code

Code: Select all

    Private Const conProviderNameSpaceSQL As String = "System.Data.SqlClient"
    Private Const conProviderNameSpaceJET As String = "System.Data.OleDb"
    Private Const conProviderNameSpaceMySQL As String = "CoreLab.MySql"

    Private varDbDataFactory As DbProviderFactory   
    Private varDbConnection As DbConnection         

      Select Case parServerReferentie.prpDbTypeGet
        Case intDbcServerReferentie.enmDbType.encDbJet
          varDbDataFactory = DbProviderFactories.GetFactory(conProviderNameSpaceJET)
        Case intDbcServerReferentie.enmDbType.encDbMySql
          varDbDataFactory = DbProviderFactories.GetFactory(conProviderNameSpaceMySQL)
        Case intDbcServerReferentie.enmDbType.encDbSql
          varDbDataFactory = DbProviderFactories.GetFactory(conProviderNameSpaceSQL)
      End Select
When i execute the code it returns the following error:
System.InvalidOperationException: The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type..
CoreLab.MySql.MySqlDirectFactory inherits from CoreLab.Common and not System.Data.Common!

This is the Stack Trace from the error:

Code: Select all

    at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at SnelStart.nspData.clsDbcConnection..ctor(intDbcServerReferentie parServerReferentie, intDbcDatabaseReferentie parDatabaseReferentie)
   at tpnDbConnection.testDbConnection.TestConnectieMySqlOpen()
Any ideas or other solutions?

Regards.

Serious

Post by Serious » Tue 03 Jan 2006 07:53

MySQLDirect .NET 3.20 for .NET Framework 2.0 contains MySqlProviderFactory class derived from System.Data.Common.DbProviderFactory.

You can find discussion about using Provider Factory here.

JvanDorsten
Posts: 10
Joined: Tue 03 Jan 2006 15:59

Post by JvanDorsten » Mon 09 Jan 2006 08:20

As you can see, the support desk advised me earlier to use the invariant name: "CoreLab.MySql" (in the beta)
I find it a logical name since the default invariant names for the other providers are: System.Data.Odbc, System.Data.SqlClient and so on.

Now if i install MysqlDirect it adds the provider with the invariant name: MySQLDirect.NET Data Provider
Will future editions continue to use "MySQLDirect.NET Data Provider" or is there a change it will be changed in "CoreLab.MySql" ?

Serious

Post by Serious » Tue 10 Jan 2006 14:12

JvanDorsten wrote:Now if i install MysqlDirect it adds the provider with the invariant name: MySQLDirect.NET Data Provider
We have fixed this problem for the MySQLDirect .NET.
Correct Provider Invariant Name is "CoreLab.MySql".
Look forward for the next build.

Post Reply