Johan
Johan

Reputation: 76567

open source component for postgreSQL

I would like to know if there are any open source components available for Delphi XE-2 that can connect to postgreSQL other than using outdated techniques like ODBC.

For now just Win32 support is needed, but if Win64 and OS-X support is also available that would be a bonus.

I googled around a bit, but the only lib that's available (ZEOS) looks like it is no longer in active development.
There does seem to be a patch for Delphi XE2 but I could not get it to compile.

Upvotes: 2

Views: 7150

Answers (2)

afrazier
afrazier

Reputation: 4902

As of right now: No.

You either route through ADO -> ODBC, dbExpress -> ODBC (for XE2*, see below), hope to make Zeos work, or pay for one of the various commercial components (PostgresDAC, DevArt, or AnyDAC, to name a few).

While Delphi XE2 comes with an ODBC driver for dbExpress, it's only for the Enterprise SKU and higher -- it's not available in Pro. For XE2 Pro users and users of older versions of Delphi there's Open dbExpress. I've tried using it before, but always had trouble with it. It's been updated since I've last used it though, so maybe whatever problems I had (which may have been my own fault) aren't an issue anymore.

All this said, ODBC isn't really an outdated technology. On non-Windows systems it seems to be the preferred DB-agnostic API. That said, it seems that many environments prefer to implement their own connectivity (e.g. QT, GNOME) rather than relying on ODBC exclusively. However, for the PostgreSQL project itself, their default (and best supported) connectivity API is ODBC.

Update: In fact, Microsoft is making ODBC their premier connectivity API for SQL Server starting with SQL Server 2002 (codenamed Denali). See: Microsoft Aligning with ODBC and Microsoft is Aligning with ODBC for Native Relational Data Access. This is the last release that will support OLE DB, and Microsoft is encouraging developers to use ODBC.

Upvotes: 8

Johan
Johan

Reputation: 76567

Turns out you can get ZEOS to work on Delphi XE2 and as far as I've tested all DB functionality works.

Here are the steps to follow:

  1. Use SVN* to download the Delphi XE2 archive for ZEOS at:
    https://zeoslib.svn.sourceforge.net/svnroot/zeoslib/branches/testing
  2. Put the zeos folder in the appropriate place, I'm assuming c:\borland
  3. Do not open Delphi yet, but instead open
    C:\borland\zeos\packages\delphi16\ZComponent.dpk in wordpad and remove the trailing {$IFDEF} (remember to keep the ; in place).
  4. Open c:\borland\zeos\packages\delphi16\ZeosDbo.groupproj.
  5. Choose build all
  6. Open c:\borland\zeos\packages\delphi16\build in explorer, copy all .bpl files and copy those to c:\borland\delphixe2\bin
  7. Component -> install packages -> [add...] and choose
    c:\borland\delphixe2\bin\ZComponentDesign.bpl

    as a SVN client I've downloaded SVN-tortoise from: http://tortoisesvn.net/downloads.html
    Combined with both the SVN plug-ins for Firefox

Upvotes: 1

Related Questions