Is there a way to catch timeout on InitializeAsync method in JdbcSQL?
In this code:
B4X:
MSQL.InitializeAsync("mssql", driver, jdbcUrl, Username, Password)
Wait For mssql_Ready (Success As Boolean)
Return Success
I always get "true" when is OK connected, but never "false" (even if it can't connect) ... it looks to me as there is no timeout set for InitializeAsync (or I didn't set it up).
There is a timeout set to 30 seconds here, when connection is failed Success is false. you can test it by changing jdbcURL or deploying a local mysql,
Check if there is a firewall in your network.
For the record, I did it in this way ... simulate Wait For with timeout:
B4X:
Sub Connect As ResumableSub
MSQL.InitializeAsync("mssql", driver, jdbcUrl, Username, Password)
TimeoutImpl(8, "mssql_Ready")
Wait For mssql_Ready (Success As Boolean)
Return Success
End Sub
Sub TimeoutImpl(Duration As Int, EventName As String)
Do While Duration > 0
Sleep(1000)
Duration = Duration - 1
Loop
CallSubDelayed2(Me, EventName, False)
End Sub