I'm newbie in remote data access, so I need help.
I working connecting than disconnecting TMyConnection each request. For example, if I have to populate an combo box or something, first I ran the query, put the information and than I close the connection. Is that correct? There is another way, or better way, to do that?
Also I'm using TVirtualTable and TCRBatchMove to simulate Client Dataset functionality.
Is this the best practice to work with remote databases? The server is in the office and the client is in another place, they are connected through the internet.
I appreciate any kind of help.
Remote Access DB
-
DemetrionQ
- Devart Team
- Posts: 271
- Joined: Wed 23 Jan 2013 11:21
Re: Remote Access DB
Hello.
There are two ways you can use to work with the server:
1) maintain a continuous connection to the server. This way has a disadvantage of vulnerability in situations when server connection is unstable.
2) connect to the server temporarily, only to execute queries. The disadvantage of this way is slower work with the server because of additional time spent on authentication when establishing every connection.
To implement the 2nd way, you don't have to close the connection yourself after every query execution, just set the TMyConnection.Options.DisconnectedMode property to True and MyDAC will do that automatically (for details refer to http://www.devart.com/mydac/docs/index. ... edmode.htm ).
The article http://www.devart.com/mydac/docs/unstable_network.htm describes ways of MyDAC optimization in order to work with unstable network connection.
There are two ways you can use to work with the server:
1) maintain a continuous connection to the server. This way has a disadvantage of vulnerability in situations when server connection is unstable.
2) connect to the server temporarily, only to execute queries. The disadvantage of this way is slower work with the server because of additional time spent on authentication when establishing every connection.
To implement the 2nd way, you don't have to close the connection yourself after every query execution, just set the TMyConnection.Options.DisconnectedMode property to True and MyDAC will do that automatically (for details refer to http://www.devart.com/mydac/docs/index. ... edmode.htm ).
The article http://www.devart.com/mydac/docs/unstable_network.htm describes ways of MyDAC optimization in order to work with unstable network connection.