From Data Snap to Data Snap
Compared to traditional DataSnap application, there are a few significant differences, more related to the architecture and deployment than the actual code you have to write:
- There is no COM involved for the development of the server. Even if a client could already use sockets in the past, a socket-to-Com mapping service was required on the server. Now the client and server applications communicate directly over TCP/IP.
- As a side effect, you don't have to register the server, nor run any helper service on it. All the server has to provide to the client is an open TCP/IP port the client can reach
- You must manually run the application on the server, or create a service for it. In the past the COM support implied the server application would be started as needed.
- The server implementation is slightly more complicated in terms of components, but there is very little code behind the scenes, as for the COM counterpart.
- The client implementation is almost identical, as we need a standard SQLConnection component, in place of a specific connection object.
- On the server side, the TDSServerModule class inherits from TDataModule, including the IAppServer interface (the same interface used in the past by a COM-based TRemoteDataModule) and enabling the $MethodInfo compiler directive.
- As the client-side dbExpress driver is a pure 100% Delphi driver, you don't need do deploy any DLL on the client computer, even if you are using dbExpress for the connectivity.
- Pay a lot of attention when closing the server application. Unlike in the COM architecture, which warns you about pending connections, a DataSnap 2009 server will seem to close, but won't until there are no remaining connections to it. However, even after the connections have been closed it will remain running in memory, even if the main form is gone. You'll need to use Task Manager (or Process Explorer) to terminate the server. You might think that closing all existing client applications will be enough, but it is not: The Delphi IDE, in fact, can open a connection to the server even automatically, for browsing its exposed classes and methods. Be sure to close any SQLConnec-tion to the server before stopping it.
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.
Get My Free Ebook