How to connect a universal W10 application with a MySQL database

I am writing my first Windows 10 Universal application that runs in a MySql database. I used the code from this guide (it is for Windows 8 apps):

https://blogs.oracle.com/MySqlOnWindows/entry/how_to_using_connector_net

But when I try to open a connection to my database, I get an error message:

An exception of type "System.NotImplementedException" occurred in> MySql.Data.RT.dll, but was not processed in the user code

Additional Information: SSL is not supported in this version of WinRT.

public class DBconnector { static string server = "127.0.0.1"; static string database = "hurtownia"; static string user = "root"; static string pswd = "root"; public static bool login(string email, string password) { string connectionString = "Server = " + server + ";database = " + database + ";uid = " + user + ";password = " + pswd + ";"; using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); MySqlCommand checkLogin = new MySqlCommand("select password_hash, password_salt from users where email = \""+email+"\"",connection); using (MySqlDataReader reader = checkLogin.ExecuteReader()) { reader.Read(); string hash = reader.GetString("password_hash"); string salt = reader.GetString("password_salt"); bool result = passwordGenerator.compare(password, hash, salt); if (result) return true; else return false; } } } } 

So my question is how to fix this and connect correctly to the MySql database in the Windows 10 Universal App.

+7
c # mysql win-universal-app
source share
2 answers

Add "; SslMode = None" to the connection string

+16
source share

I am sure that the SSL connection is not supported by the MySql WinRT connector. You must disconnect the SSL connection to the MySql server.

Chapter 8 Connector / Network Support for the Windows Store

/ Net RT Connector does not support SSL or Windows authentication. In addition, SHA256 is not supported correctly.

6.3.6.4 SSL Command Parameters

BTW, another alternative way to get data from mysql is the REST service: Application β†’ Rest Service β†’ MySQL

0
source share

All Articles