Getting GNATcoll-gpl-2010 to connect to PostgreSQL

There’s an undocumented “feature” in the GNATcoll-gpl-2010 package: It can only connect to a PostgreSQL server if the server accepts SSL connections.

This is of course not always an option, and in those cases the otherwise excellent GNATcoll database interface is suddenly rendered useless.

There’s a fix though: Get rid of the “requiressl=” string in the GNATcoll sources before compiling it.

Unpack GNATcoll, cd into the top-level directory, and then do:

grep -R -i -n “requiressl=” .

That should give you:

./src/postgres/with_postgres/gnatcoll-sql-postgres-builder.adb:358: Append (Str, ” requiressl=0″);

Open that file and remove or comment line 358, and voila! you will be able to connect to your PostgreSQL server again.

It would’ve been nice if this specific “feature” had been documented somewhere, as I’m sure lots of people don’t use SSL for their local PostgreSQL servers.

At least we now know that the current GNATcoll development version offers more control over this, so it will probably get fixed in GNATcoll 2011, though I wouldn’t mind if it happened sooner.

Leave a Reply