Reconnect to DataSnap server or MySQL server

I'm trying to make a DataSnap server/client system.

Apart from a lot of other problems the most troublesome problem right now is that I am unable to reconnect a TSQLConnection after it has failed.

I have several TSQLConnections:
* Client -> DataSnap Server
* DataSnap Server -> Other DataSnap server
* DataSnap Server -> MySQL Database

All these connections will sometimes die. For example if the internet connection goes down or if one of the servers (MySQL/DataSnap) is restarted.
When this happens I will get an Exception and the current SQL query or server method fails. After it has failed I need to reconnect to the server, but I fail to see how it is possible to do that.
There is no method to reconnect and it doesn't reconnect on its own. It just continue to fail even after the server is back online.

So my to put it straight, my question is: How do I reconnect a dbExpress failed TSQLConnection / TDBXConnection??

I use C++ Builder XE2 Update 3
0
Patrik
2/24/2012 10:16:58 AM
embarcadero.datasnap 643 articles. 1 followers. Follow

2 Replies
1804 Views

Similar Articles

[PageSpeed] 11

Did you ever figure out how to do this?
0
Allen
4/18/2013 3:59:42 AM
Just to answer how I recover from disconnected client.

Just doing a Server.connected := false, and server.connected := true doesn't work.

I had to free and create the servermethodsclient module as well.  

I am able to restart the Datasnap server and the client will re-establish the data connection automatically.

Hope this helps someone.
0
Allen
4/25/2013 7:38:30 PM
Reply: