I have a method which is passed a SQLDatabaseMBS database and checks if it is non-nil, is alive, is connected, etc and if true returns the existing live database, otherwise re-connects or builds all the settings afresh. This means I can have one method to define, connect and reconnect to any database. Normally the tempSQLDatabaseMBS would be passed in, but I have DIM’ed it here to show the error.
I have extracted the snippet below that later checks if the database can connect. In macOS and Windows the code works without crashing and fails to connect (as it should). But in Linux the tempSQLDatabaseMBS.ConnectMT function crashes the app totally (not trapping an error).
It would be good if Christian could enable this to fail gracefully (I.e. return false) rather than kill the app in Linux.
[code]Dim tempSQLDatabaseMBS As New SQLDatabaseMBS
if tempSQLDatabaseMBS.ConnectMT then 'app crashes on this line in Linux only
MsgBox “We connected”
else
MsgBox “We failed to connect” 'correct answer
end if[/code]
Sorry, but even with the RaiseExceptions set to true the app still crashes. I placed a try end try wrapper, but it still crashes and is not caught.
[code]Dim tempSQLDatabaseMBS As New SQLDatabaseMBS
tempSQLDatabaseMBS.RaiseExceptions = True
try
if tempSQLDatabaseMBS.ConnectMT then 'Linux app still crashes on this line despite try end try
MsgBox “We connected”
else
MsgBox “We failed to connect” 'correct answer
end if
I have removed this code in the meantime (for Linux only), so it will recreate the database definition (on Linux) if it becomes disconnected, rather than just reconnect. Thank you.