Situation: I have simulated the loss of connection by simply doing a shutdown of the server. However, when closing the connection in my app before connecting to another database also makes the app crash. The crash is so hard that I don't even get a crash log.
I would like to get an opinion if there is something obviously stupid with the code I'm using for connecting. I have omitted the obvious stuff like setting the parameters for database, server etc and any error handling.
Constructor:
Valentina.ShutDown()
Disconnect
ConnectServer
if theDatabaseConnection <> Nil and theDatabaseConnection.IsConnected then OpenDBServer
Disconnect:
if theDatabase <> nil then
if theDatabase.IsOpen then theDatabase.Close()
theDBFolderitem = nil
theDatabase = nil
end if
'close valentina
if isClientServer then
if theDatabaseConnection <> nil and theDatabaseConnection.IsConnected then
theDatabaseConnection.Close()
end if
theDatabaseConnection = Nil
theServer = Nil
end if
ConnectServer:
Valentina.InitClient()
dim ConnectionThread as new getConnectionThread(Host, Login, ServerPassword, Port, conserv, MaxUsers)
ConnectionThread.Run
dim Timeout as Integer = Ticks + 30 * 60
While not ConnectionThread.ConnectionIsOpen
if Ticks > Timeout then
'some code
end if
app.SleepCurrentThread(10)
Wend
'got some problems
if ConnectionThread.ProblemsOccurred then
'some code
end if
'everything went fine
theDatabaseConnection = ConnectionThread.getConnection
theServer = new VServer(theDatabaseConnection)
getConnectionThread:
theDatabaseConnection = new VConnection(Host, Login, ServerPassword, Port, 30, conserv)
theDatabaseConnection.Open()
Because this code crashes so hard I don't have a good idea what might go wrong here.
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals