Hi there i was reading this thread about check_connection but i can't find the point i want.
When the tablet/phone is disconnected from wifi and want to connects at db ofcourse can't connected... I am having a label that saying is not connected at internet but i wanna app try every 15 seconds to get connected so i believed that i must use the following:
Somewhere read that check_connection is like a ping and if not connected at the db will try again..
but getting this:
What's the best solution to try to connect again to the db if not connected from the start (because device was not connected to the internet) ?
When the tablet/phone is disconnected from wifi and want to connects at db ofcourse can't connected... I am having a label that saying is not connected at internet but i wanna app try every 15 seconds to get connected so i believed that i must use the following:
Somewhere read that check_connection is like a ping and if not connected at the db will try again..
B4X:
Sub Timer2_Tick
db.check_connection
end sub
but getting this:
MySQL Database not connected!
ReConnecting
main_timer2_tick (java line: 867)
java.lang.NullPointerException: Attempt to invoke interface method 'void java.sql.Connection.close()' on a null object reference
at de.donmanfred.b4a.MariaDB.auto_reconnect(MariaDB.java:1097)
at de.donmanfred.b4a.MariaDB.check_connection(MariaDB.java:1142)
at mvt.client.main._timer2_tick(main.java:867)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5624)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
What's the best solution to try to connect again to the db if not connected from the start (because device was not connected to the internet) ?