Connect to a Postgres database

I try to connect using UniDac, but receive an error Can't find unit dbAccess.

I have located the file and put the path into the Library Path in Options.

But do I need the Pas file? I have only Dcu files.

I have no problems using UniDac in an ordinary Vcl application.

Ole

Please note that you can not directly use VCL dataset / database access in a web client application.

Database access in web application is typically handled via putting a REST API on this database and using the REST API from your web client application. Our TMS XData product or Embarcadero RAD server or open source solutions such as MARS REST or morMot all offer this.
Several videos at https://www.tmssoftware.com/site/videos.asp?vcatsel=9 cover this, for example https://www.tmssoftware.com/site/videos.asp?v=106
I have watched a lot of videos, bought two cources, bought a book. But as far as I can see none explain how to use third party drivers, only native drivers.

My goal is really simple, connect to a Postgres database and show the contense of a small table.

I even hired a programmer at Upwork, he presented a working sample, OMG was that code complicated :) He delivered approx. 1000 lines of code just to connect and show a table in a grid :)

Here is a little sample, I have no idea what is going on:

    if Field = nil then
      Continue;
    FieldName := Field.FieldName;
    if Pos('.', FieldName) = 0 then
      Prop := EntityType.FindProperty(FieldName)
    else
      Prop := EntityType.FindNavigationProperty( TJSString(FieldName).split('.')[0] );
    if Prop = nil then
      Continue;
    PropType := FindPropertyType(EntityType, FieldName);
    if PropType = nil then
      Continue;
    case PropType.TypeKind of
      TXTypeKind.xtInt16, TXTypeKind.xtInt32, TXTypeKind.xtInt64,
      TXTypeKind.xtDouble, TXTypeKind.xtCurrency:
      begin
        if IsNumber(AFilterText) then
          FilterExpressions.push(Format('(%s eq %s)',
            [TJSString(FieldName).replace('.', '/'), AFilterText]));
      end;
      TXTypeKind.xtText:

-------------------------------------------
Now, I started the wizard from File...New...Other and created a TMS Xdata VCL server. The wizard used SparkleHttpSysDispatcher, XDataserver, XDataConnectionPool and AureliusConnection.

Then I plased a TUniConnection and a TPostgresqlUniProvider on the form.

I started the Aurelius Connection Editor and used Adapter Mode.
  • Adapter Connection: UniConnection1
  • Adapter Name: UniDac
  • Sql Dialect: Postgresql
I tried to test the connection and received an error message: "Adapter "UniDac" is not supported at design-Time.

Nor can I Generate Entities fra the database right clicking on the AureliusConnection.

I cannot use more time on this, is it possible you or a partner could do a sample program that use UniDac and connect to Postgres, I shall of course pay for the work :)

Regars
Ole

UniDAC adapter is indeed not available at design-time. But you can simply use a FireDAC connection, if you have it available, to do so. Or use TMS Data Modeler tool to generate the entities, it's even more powerful than at design-time.


Regarding your code, it looks indeed like a code that does a lot of things, but I wonder what is your use case. It looks like some dynamic system for filtering, I don't think that's necessary at all for simple purpose. All you need is just connect the dataset. Can you elaborate more about that code your developer did? What are the requirements? What does it do?