Blog

All Blog Posts  |  Next Post  |  Previous Post

Video: Accessing any Delphi compatible database through a REST API using SQL

Bookmarks: 

Monday, May 20, 2019

I have expressed this before, but Delphi is and will hopefully always be the number one programming language for database-driven applications. The architecture that has been there since Delphi 1 is still standing strong. Of course, there has been need for change to the database drivers, due to technological advances. However, at the inner core the classes TDataset and TDataSource as still standing strong.

Web Applications, multi-platform development, and mobile platforms make it necessary to introduce a layer in between the database and the application. Web Services producing JSON formatted data following the REST principle have become the pseudo-standard. As a side-note, REST is still not a standard and only a principle.

SQL is still the database query language that developers feel most comfortable with. The Web Service Layer introduces an insurmountable challenge for many. Thus, there are more frameworks than sand at the beach to facilitate the process. TMS Software offers a straightforward, affordable solution if you need to build a Web Service API with JSON called XData. If you look for performance, no need for JSON and a quick way to migrate your database project use RemoteDB from TMS instead.

For the case that you need a REST API with JSON support, I recorded the following video. It teaches you how to hook up any database supported by Delphi to the web service. You will then be able to offer any SQL query as a result for the web service. Further, you can even use parameters.

Stay tuned for more video content about RemoteDB. An even quicker and more efficient solution to provide abstract database support to your client applications. Abstract database support means in this case that the client is unaware which database you use and also will not need the database driver technology to access the data.

The video will explain step-by-step how to:
  • Create a web service with XData
  • Add the database connection to a FireDAC database
  • Add the database query
  • Add a service for the SQL queries
  • Write a VCL Forms client that displays the data
Be aware of the fact that the client will not need any XData-specific components.



Errata

The VCL client actually does not need to create the TStream instance as the XData framework does that. Thus, the correct client-side code is this:

LStream := LService.GetSchools as TMemoryStream

There is no need to do anything else with LStream.

Holger Flick


Bookmarks: 

This blog post has received 6 comments.


1. Wednesday, May 22, 2019 at 8:08:07 PM

Thank you for this very good video. Before this video, I was under the misunderstanding that all the various TMS web components, e.g., RemoteDB, were all required for web services. You showed how easy it is with XDATA - alone.
Is there any way to get the sample code?
Thanks again,

CHRIS KUSSURELIS


2. Thursday, May 23, 2019 at 8:43:44 AM

Sure, the source code can be download here:
http://www.tmssoftware.net/public/XData-FireDac-demos.zip

Bruno Fierens


3. Thursday, May 23, 2019 at 8:08:06 PM

Greetings, I watched this video a second time and I noticed that the ''XDataConnectionPool'' component was deleted. Should I infer that this particular example does not include Connection Pooling? If so, will you be coming out with a video that includes Connection Pooling, but does NOT include Aurelius ORM? (my application has no need of ORM) Thanks again to all the developers at TMS Software.

CHRIS KUSSURELIS


4. Thursday, May 23, 2019 at 8:35:12 PM

Can you do it with UniDAC and ZEOS?

Abramczyk Michal


5. Thursday, May 13, 2021 at 5:58:44 AM

compre tus 3 libros que tienes publicado, cuando estara disponible el siguiente libro que menciono Wagner R. Landgraf en su webinar "lo nuevo en xdata 5", ya que menciona que tienes un ejemplo paso a paso para construir un servidor xdata 5 que maneje varias bases de datos en un solo servidor.

en caso de que el libro no este listo proximamente, tienes un ejemplo que use este modelo?

Gracias

francisco banda


6. Friday, May 14, 2021 at 2:50:30 AM

I will need another 4-6 weeks to publish as I am still writing content and not proof reading yet.

Holger Flick




Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post