Reputation: 35
When attempting to retrieve data from a mysql database I come across this error 'MySqlConnector.MySqlException: 'Connect Timeout expired.' Looking online told me to check the call stack which presented me with this message that I personally don't understand:
0xFFFFFFFFFFFFFFFF in System.Diagnostics.Debugger.Mono_UnhandledException_internal C# 0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Diagnostics/Debugger.cs:125,4 C# 0x20 in Android.Runtime.DynamicMethodNameCounter.39 C# 0x12 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:157,13 C# 0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__7_0 at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021,49 C# 0xC in Android.App.SyncContext. at /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36,19 C# 0xE in Java.Lang.Thread.RunnableImplementor.Run at /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36,6 C# 0x8 in Java.Lang.IRunnableInvoker.n_Run at /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Java.Lang.IRunnable.cs:84,4 C# 0x11 in Android.Runtime.DynamicMethodNameCounter.39 C#
Can someone please explain this error and how to fix it? This is what I believe is the problematic code:
async void LoginClick(object sender, EventArgs args)
{
string enter_email = Email.Text;
using (var connection = new MySqlConnection("server=localhost;user=app;database=travel_logger;port=3306;password=app"))
{
connection.Open();
var cmd = new MySqlCommand("SELECT _Password FROM * WHERE email=" + enter_email);
var reader = await cmd.ExecuteReaderAsync();
string data_password = reader.GetString(0);
if (data_password == Password.Text)
{
await Navigation.PushAsync(new AboutPage());
}
}
}
Upvotes: 1
Views: 498
Reputation: 35
It turns out I was using a public ip address rather that I found from Google. I found the correct one from my settings and it worked. Local host didn't work as the connection was remote
Upvotes: 0