What is the best way to write a client-server application under delphi? I know there's a DataSnap technology, but it's not in Professional version. Do You have any experience that You can share?
-
3Are you interested in 3rd party solutions also, or only what comes in the box for the Professional version ? – Tim Young - Elevate Software Mar 08 '11 at 11:50
-
Are you looking for client-server DB solution or more generic client-server communication? – Eugene Mayevski 'Callback Mar 08 '11 at 11:57
-
@Tim Would be the best without any 3rd part components @Eugene MultiTier Solution – JustMe Mar 08 '11 at 12:52
-
If you don't want any third party components, and you want more features in Delphi, why don't you just upgrade from Pro to Enterprise? – Warren P Mar 08 '11 at 19:58
-
@Warren Thanks, we will think about all possibilities and choose the best. – JustMe Mar 09 '11 at 08:22
7 Answers
This is fairly wide open question, as it can depend on your database decision.
DataSnap really allows for N-Tier solutions, if your looking for Client Server you have most everything you need in the professional version depending on the Database Choice.
For Client Server:
Client Server Architecture is when the Client communicates directly with the server.
There are several frameworks available they all follow the same pattern.
DB Connection -> Query -> (Optional Provider -> TClientDataset) -> TDataSource -> Visual Control
DBX
- TSqlConnection - Connects to the Database
- TSqlQuery - Query against DB producing uni-directional Dataset
- TSqlStoredProc - Executes Stores Procedures against DB
ADO
- TAdoConnection - Connects to Database
- TAdoQuery - Query against DB producing Bi-Directional Dataset
Common Components
- TClientDataSet - In Memory dataset that is bi-directional
- TDatasetProvider - Takes other datasets and ties the data to TClientDataset
- TDataSource - Ties a Dataset to a data-aware visual control
There are several other options available depending on Database Choice.
However, you seem to be asking about N-Tier (Middle-Tier) type solutions
For N-Tier
N-Tier architecture is when the Client communicates with Middle Tier that then communicates with the Server. It's referred to N-Tier as you have option to have multiple Middle Tiers or Application Servers.
Commercial Options (Required additional $$ to be spent)
- DataSnap
- DataAbstract
- RemObjects SDK (Part of DataAbstract but can be used by itself)
- KBMMw
- Midware
I personally don't know of any free or open source options, although I suspect some exist.

- 12,447
- 2
- 48
- 80
-
@Robert Love - we use Firebird 2.5 and Devart VCL components for Interbase (IBC). I understand this dependence, but I'm very interesting in how should I separate client from server and how should they communicate with each other. – JustMe Mar 08 '11 at 11:55
-
4Sounds like you asking for a middle Tier Solution. Not a Client Server Solution. – Robert Love Mar 08 '11 at 11:57
-
-
2@Robert, @JustMe: Which means going with a middle tier (or n-tier) solution or rolling your own. And I wouldn't recommend the latter. Where I work, we are considering replacing our own communication framework with a commercial one. If only so we don't have to invest any more (wo)manpower in maintaining it... – Marjan Venema Mar 08 '11 at 12:04
-
@Robert : WST (http://wiki.freepascal.org/Web_Service_Toolkit) is a free and open source option. It is compatible with Delphi. Better check out from svn as the 0.5 release is actualy outdated. – Inoussa OUEDRAOGO Mar 08 '11 at 14:41
Two options:
- DIY (Do It Yourself). Write a communications layer and protocol yourself using Indy and/or ICS internet components. A lot of hard work and needs a lot of testing to get right.
- Use a ready made framework such as kbmMW: http://components4developers.com/ or RemObjects: http://www.remobjects.com/ Both are not free but well worth the money you pay even if only measured by the development time/costs that you spare.

- 19,136
- 6
- 65
- 79
-
1If you are considering paying for remobjects, also you should be aware that you can just buy an upgrade from Pro to Enterprise, and get DataSnap. – Warren P Mar 08 '11 at 19:57
You can use WST is a free and open source toolkit for web services consumption and creation with support for SOAP and XmlRPC and JsonRPC (the JsonRPC support is available only for FPC). It is compatible with Delphi. Better check out from svn as the 0.5 release is actualy outdated.

- 507
- 2
- 5
With Delphi Professional it is possible to write simple (no WS-* standards, no Soap 1.2 servers) SOAP client and server applications.
In many cases, Soap offers advantages regarding cross-platform / cross-language integration, standardization, design-by-contract and mature implementation guidelines, best practices and patterns.
For Soap there are great (and free) tools like SoapUI and IDE editors for Web Service Description Language (WSDL) documents like NetBeans.

- 36,362
- 28
- 176
- 378
Take a look at our Open Source Client/Server ORM.
It's multi-tier compatible, and you can have ORM at both Client and Server level. ORM is used everywhere, and JSON is the format chosen for the Client/Server transmission.
You can start your application as local application, then just by changing the class type used to access to the data, it will become a Client/Server application communicating via Named Pipes, HTTP/1.1 or GDI messages.
It was designed to work with SQLite3 as a small but efficient database engine on the server side, but you can use the ORM without SQlite3. There is a pure Delphi in-memory engine provided, if you prefer.
This framework try to implement N-Tier architecture from the bottom up. The upcoming 1.13 version will have a powerful filtering and validation mechanism, perfect for N-Tier architecture. There is some User-Interface units, with full reporting (and pdf generation), able to create most of the User Interface from code, using the ORM layout of the data.
It's based on the RESTful paradigm to access the data from the Client, via JSON. And there is a easy way of implementing Client/Server Services if the RESTful approach is not enough, just like DataSnap.
It's Unicode ready (uses UTF-8 at all internal level), and works with every version of the IDE, from Delphi 6 up to XE (even the Starter edition).

- 42,305
- 3
- 71
- 159
Since a few months ago I stopped to implement new projects with this kind of architecture (n-tiers, 2-tiers) Based on Delphis and specific DB technologies. I believe these architecture are not future prof. The architecture i'm using now is a 2-pier one. The server is a normal HTTP server. It works as app server* and optionally provides a web client. Developing clients in Delphi it's harder but worth it. Since specif tools are not available as the ones offered for DB connections, I use indy to send and receive data from the HTTP server. I do a GET
request to fetch data and then parse it to show it on the GUI. Then a POST
request to update or insert new data. The HTTP server handle all business logic :-)
Apart of being future prof, this architecture is cheaper and platform independent. And if you analyze it, this is the same architecture used by most mobile apps. So, if you plan to write a mobile client in the future, consider developing the app server with script languages (Python, PHP, Ruby, etc.).
That's my recommendation. Don't forget: Great things require great commitments!
- An
App Server
is a service which provides your application (thin client) with with an interface to get and send data. Also it control the business logic. Your application don't care about DB's or controlling record relations and data constrains. That's all is transparently done by the app server.

- 1,710
- 10
- 13
-
@mjn, Yes you're right! I'm used to see the HTTP server and DB as a whole :P – Christopher Ramírez Mar 02 '12 at 14:38
For general-purpose client-server communication you can use our lightweight MsgConnect product. This is a cross-platform MOM (message-oriented-middleware).

- 45,135
- 8
- 71
- 121