Creating a DataSnap Server
Go Up to File Index
File > New > Other > Delphi Projects > DataSnap Server
Use these options to create a sample DataSnap Server or Broker, or to add another Server Module to an existing DataSnap application. A Server Module allows you to implement Server Methods that can be exposed to the Client applications.
A classic DataSnap server consists of at least three components:
TDSServer manages the creation and lifetime of transports and server method classes.
TDSServerClass can be used to specify an application server-side class with published methods that can be called from a remote client using dynamic method invocation by overriding the OnGetClass event. Methods in that class can be called from remote clients, such as the DBX Client Provider or the ADO.NET provider, therefore only two requirements must be fulfilled:
- The class must be a descendant of TComponent.
- The MethodInfo directive must be enabled.
Once you have connected to a DataSnap server, you can call methods in an application server similarly to stored procedures. For instance, you can use the new class TSqlServerMethod to call server methods by specifying a text class and method name for command text and parameters for the method. Server methods can use a TDBXReader to receive and return datasets to and from the client. The new smart tables are an abstraction of the different datasets DataSnap supports, so they can be passed transparently between client and server.
You can still write application server-side classes that extend TRemoteDataModule, so that the providers they contain can be accessed by the new client-side TDBXAppServerConnection client component. TDBXAppServerConnection provides connectivity to a DataSnap server using dbExpress and is provided to keep existing applications compatible and take advantage of new DataSnap features. New applications do not need to use TRemoteDataModule with DataSnap.
Note: Application servers need not be connected to databases at all.