Brook and Firebird: The example in the path 'demos\db\rest' does not work we lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- jbetancurt · 2014-10-08 20:46 hello, when I change the configuration file "dbUtils" example that comes to rest applications, as follows: Code: [Select]function con: TdSQLdbConnector; begin //  if not Assigned(_con) then   begin     _con := TdSQLdbConnector.Create(nil);     _con.Driver := 'Firebird';     _con.Host := 'localhost';     _con.Database := 'D:\test.fdb';     _con.User := 'sysdba';     _con.Password := 'masterkey';     _con.Port:= 3050;   end;   Result := _con; end;      I get the following error message: "Error: Unknown type connector" By testing in a visual application I copy and paste the same code to the onclick and agreugue few lines as seen below: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var    _con : TdSQLdbConnector;    qry : TdSQLdbQuery; begin     //if not Assigned(_con) then   begin     _con := TdSQLdbConnector.Create(nil);     qry := TdSQLdbQuery.Create(_con);     _con.Driver := 'FIrebird';     _con.Host := 'localhost';     _con.Database := 'D:\test.fdb';     _con.User := 'sysdba';     _con.Password := 'masterkey';     _con.Port:= 3050;     _con.Connect;     qry.SQL.Text := 'select id, name from person';     qry.Open;     qry.First;     while not qry.EOF do     begin       ShowMessage(qry.Field('name').AsString);       qry.Next;     end; end;  When I send the command "_con.Connect;" generates the same error, but if the application then put a "TSQLConnector" component on the form and we will set up with the same information and connect and disconnect it using the database connection that works fine (which is normal), but hereinafter called the command "_con.Connect;" stop sending the error message and it works fine .. the problem I have is that the cgi APPLICATION, I can not add visual components. ---------------------------------------------------------------------- Mike.Cornflake · 2014-10-09 05:16 Try uncommenting the safety check.   I'm guessing the connector is being created twice,  with the error being raised on the second create. ---------------------------------------------------------------------- jbetancurt · 2014-10-09 07:55 Now uncomment and continues: "Error: Unknown type connector" ---------------------------------------------------------------------- Mike.Cornflake · 2014-10-09 08:04 Sorry - I've no idea.  And I've realised why you commented that line - original code is implementing a singleton, you were modifying that for your own purposes, so my suggestion was silly :-( ---------------------------------------------------------------------- ttomas · 2014-10-09 08:35 Do you have IBConnection in your Uses? Firebird connection is not registered! ---------------------------------------------------------------------- jbetancurt · 2014-10-09 17:29 thanks for the help, actually lacked put "IBConnection" I leave as do all the example below: Quote from: ttomas on October 09, 2014, 10:35:44 amDo you have IBConnection in your Uses? Firebird connection is not registered! Code: [Select]unit dbutils; {$mode objfpc}{$H+} interface uses   dSQLdbBroker, SysUtils, PQConnection; function con: TdSQLdbConnector; implementation uses IBConnection; var   _con: TdSQLdbConnector = nil; function con: TdSQLdbConnector; begin   if not Assigned(_con) then   begin     _con := TdSQLdbConnector.Create(nil);     _con.Driver := 'Firebird';     _con.Host := 'localhost';     _con.Database := 'D:\Trabajo_Clientes\pruebaTioPF\test.fdb';     _con.User := 'sysdba';     _con.Password := 'masterkey';   end;   Result := _con; end; finalization   FreeAndNil(_con); end.