Android Question JdbcSQL InitializeAsync timeout

Drago Bratko

Active Member
Licensed User
Longtime User
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).
 

teddybear

Well-Known Member
Licensed User
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.
 
Last edited:
Upvote 0

Drago Bratko

Active Member
Licensed User
Longtime User
Hmm ... on my side, I receive or true if all is fine, or nothing (event mssql_Ready is not trigered) if it can't connect.
 
Upvote 0

Drago Bratko

Active Member
Licensed User
Longtime User
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
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…