Connect (Load data from) with a relational database (MySqlServer) for ML.NET Project
I am authoring a ML.NET project and I have successfully connected with a database SQL server using the following code for testing.
MLContext mlContext = new MLContext(); DatabaseLoader loader = mlContext.Data.CreateDatabaseLoader<HouseData>(); string connectionString = @"Data Source=localhost;Initial Catalog=MYDATABASE;User Id=username;Password='7890'"; string sqlCommand = "SELECT Size, CAST(NumBed as REAL) as NumBed, Price FROM House"; DatabaseSource dbSource = new DatabaseSource(SqlClientFactory.Instance, connectionString, sqlCommand); IDataView data = loader.Load(dbSource);
The problem is that in reallity I want to connect with a MySql Server (localhost) (using XAMPP: Apache and MySql) and not with SQL server and I cant do it with the same code.Can Someone please help me with the MySql server Code? What are the differences and why cant I connect?