Internals

pgJDBC employs a few behaviours that strictly expect a PostgreSQL server on the other end, so that some operations will fail on databases offering wire-compatibility with PostgreSQL, but do not provide certain features like the hstore or jsonb extensions.

The background is that, when using the jdbc:postgresql:// JDBC driver prefix, downstream applications and frameworks will implicitly select the corresponding dialect implementation for PostgreSQL.

Compatibility

While CrateDB is compatible with PostgreSQL on the wire protocol, it needs JDBC support for its SQL dialect, provided by the jdbc:crate:// protocol identifier.

Note

For basic and general purpose use, the official PostgreSQL JDBC Driver can also be used. Sometimes, it is easier because pgJDBC is included into many applications out of the box.

Differences to pgJDBC

The driver is based upon a fork of the PostgreSQL JDBC Driver, see pgjdbc driver fork, and adjusts a few details to compensate for behavioral differences of CrateDB. Please take notice of the corresponding implementation notes:

Supported:
  • A few metadata functions have been adjusted to better support CrateDB’s type system.

  • The CrateDB JDBC driver deserializes objects to a Map, pgJDBC treats them as JSON.

  • DDL and DML statements are supported through adjustments to the PgPreparedStatement and PgStatement interfaces.

Unsupported:

To learn further details about the compatibility with JDBC and PostgreSQL features, see the specific code changes to the PgConnection, PgDatabaseMetaData, and PgResultSet classes.