Overview of Data Snap in Delphi

Originally based on a COM architecture, in Delphi 2009 the DataSnap framework was rewritten in terms of connectivity (now based on native sockets) and overall architecture, removing all dependencies from COM.

On the server side, in Delphi 2009 you could use three components87:

  • DSServer, the main server configuration component, which is needed to wire all the other DataSnap components together.
  • DSServerClass, a component needed for each class you want to expose. This component is not the class you make available, but acts as a class factory to create objects of the class you want to call from a remote client. In other words, the DSServerClass component will refer to the class that has the public interface.

87 This description is extracted from my "Delphi 2009 Handbook", which has more details and specific examples I'm not going to repeat here.

• DSTCPServerTransport, a component that defines the transport protocol to be used (this is the only protocol directly available in Delphi 2009) and its configuration, such as which TCP/IP port to use.

On the client side, you still use the ClientDataSet component for caching the remote data, but the way you connect to the server has changed from the past. The components involved are:

  • SQLConnection, generally used for dbExpress connections, has a Data-Snap driver you can configure with the proper TCP/IP port.
  • DSProviderConnection, used to refer to the server class, with the ServerCl assName property. This is the actual class you want to work with, not the DSServerClass object. This DSProviderConnection can be referenced by the RemoteServer property of the ClientDataSet.
  • SqlServerMethod, used to invoke a server side method directly (as if it was a stored procedure in a database).

Was this article helpful?

0 0

Post a comment