On 07/24/2014 04:17 AM, Sehrope Sarkuni wrote:
> John,
>
> No, the JDBC driver does not support loading data source configuration
> from LDAP or using pg_service.conf. You'll need to specify the
> database host/port/user as part of the JDBC connection string.
>
> If this custom application code where you can dynamically generate the
> JDBC URL then you could probably write it yourself (ie. query LDAP for
> the server details and build the connection string from it).
>
> If it's meant to be injected into an app server where you don't have
> full control (ex: adding it as a JNDI resource to a JEE server)
> though, I'm not sure of any workaround short of writing a wrapper JDBC
> driver that transparently does the LDAP lookup for you and then
> internally creates a PG JDBC connection from it.
It would make a great deal more sense to simply patch PgJDBC with the
desired LDAP support.
Patches like that are generally welcome if submitted upstream,
especially if they increase compatibility with and consistency wit libpq.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services