How to do it...

It's time to complete our RESTful server with database access and web client interface. Let's start:

  1. We have to modify our TDG to access database data. Open BooksModuleU.pas and drop on the data module and link the components, as follows (this is an extract of the .dfm file):
object BookModule: TBookModule  object Conn: TFDConnection    Params.Strings = (      'Server=192.168.1.112'      'Database=delphicookbook'      'User_Name=cookuser'      'Password=cookpass'      'DriverID=MySQL')    LoginPrompt = False    ConnectedStoredUsage = [auDesignTime]    Connected = True  end  object updBooks: TFDUpdateSQL    Connection = Conn      end  object qryBooks: TFDQuery    Connection = Conn    UpdateObject = updBooks  endendChange the FDConnection params accordingly with your machine. ...

Get Delphi Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.