locked
Why can't my web page software connect to my local MySql database? RRS feed

  • Question

  • User-696641838 posted

    I have verified that the connection tests successfully to my local MySql database when I test it in Server Explorer.  I specify the data source as a MySql database, the server name as localhost, the user name as Maurice, the password as 1234, and the database name as vfwd1_encdb.  In the web.config file, I defined the connection string as: “Data Source=.NET Framework Data Provider for MySQL;Initial Catalog=vfwd1_encdb;User id=Maurice;Password=1234;Trusted_Connection=False”.  But I get an error whenever I execute the code that attempts to create a new table row with data, which states: "Win32Exception (0x80004005): The network path was not found.  SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible."  Why is this referring to an SQL server when I am attempting to connect with a MySql server?  I recently installed the MySql.Data.Entity package so that I could use Entity Framework code, but it is still trying to work with an SQL server.  Why?

    Maurice

    Saturday, September 19, 2015 1:50 PM

All replies

  • User269602965 posted

    show your code attempting to make the database connection

    Saturday, September 19, 2015 5:32 PM
  • User-696641838 posted
    Thank you for responding.  Here is my Entity Framework code that attempts to insert a new row of data into my Profile table.  The error occurs at the SubmitChanges command.  Could “DataClassesDataContext” be referring to an SQL server?  If so, how do I change it?

    DataClassesDataContext db = new DataClassesDataContext();

    Profile profile = new Profile();

    profile.Names = Names;

    db.Profiles.InsertOnSubmit(profile);

    db.SubmitChanges();

     

    Maurice
    Saturday, September 19, 2015 6:26 PM
  • User-696641838 posted
    Thank you for furnishing the link regarding support for Entity Framework 6.0, which I have been studying closely.  But, I am having difficulty trying to understand how to configure my web.config file to accommodate it.  So, I am hoping that you will help me with it.
     
    I had previously configured a name for a connection string, which states "Data Source=.NET Framework Data Provider for MySQL” along with an Initial Catalog, User id, and password.  Then, I added providerName="MySql.Data.MySqlClient" as specified in the link article.  But I am having difficulty understanding the rest that deals with EntityFramework and Providers.  Am I just supposed to copy the following statements as it is?
     
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
        <providers>
            <provider invariantName="MySql.Data.MySqlClient" 
                type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
            <provider invariantName="System.Data.SqlClient" 
                type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
        </providers>
    </entityFramework>
     
    I have already made sure that my project was referencing the MySql.Data.Entity.EF6 assembly along with MySql.Data and MySql.Web.  This was referenced when I installed the MySql.Data.Entity package.  But, I do not know what to do now.  Please help.
     
    Maurice
    Sunday, September 20, 2015 8:36 PM
  • User-696641838 posted
    I attempted to include the configuration information for the EntityFramework and Providers and obtained an error that stated: Unrecognized configuration section entityFramework.  What am I supposed to do now?
     
    Maurice
    Sunday, September 20, 2015 8:48 PM