Postgresql R2DBC Driver
This project contains the PostgreSQL implementation of the R2DBC SPI. This implementation is not intended to be used directly, but rather to be used as the backing implementation for a humane client library to delegate to.
This driver provides the following features:
Supplier or Publisher REFCURSOR using io.r2dbc.postgresql.api.RefCursorCodecs to handle additional PostgreSQL data typesNext steps:
This project is governed by the Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].
Here is a quick teaser of how to use R2DBC PostgreSQL in Java:
URL Connection Factory Discovery
ConnectionFactory connectionFactory = ConnectionFactories.get("r2dbc:postgresql://:5432/");
Publisher connectionPublisher = connectionFactory.create();
Programmatic Connection Factory Discovery
…
Supported ConnectionFactory Discovery Options
| Option | Description |
|---|---|
ssl |
Enables SSL usage (SSLMode.VERIFY_FULL). |
driver |
Must be postgresql. |
protocol |
Protocol specifier. Empty to use single-host operations. Supported: failover for multi-server failover operations. (Optional) |
host |
Server hostname to connect to. May contain a comma-separated list of hosts with ports when using the failover protocol. |
port |
Server port to connect to. Defaults to 5432. (Optional) |
socket |
Unix Domain Socket path to connect to as alternative to TCP. (Optional) |
username |
Login username. Can be a plain String, Supplier, or Publisher. |
password |
Login password. Can be a plain CharSequence, Supplier, or Publisher. (Optional when using TLS Certificate authentication) |
database |
Database to select. (Optional) |
applicationName |
The name of the application connecting to the database. Defaults to r2dbc-postgresql. (Optional) |
autodetectExtensions |
Whether to auto-detect and register Extensions from the class path. Defaults to true. (Optional) |
channelBinding |
Channel binding mode for SCRAM (SASL) authentication, see ChannelBindingMode enum. Supported values: disable, prefer, require. Defaults to prefer. Use require to fail authentication unless the connection is encrypted and the server offers SCRAM-SHA-256-PLUS, preventing a silent downgrade. (Optional) |
compatibilityMode |
Enable compatibility mode for cursored fetching. Required when using newer pgpool versions. Defaults to false. (Optional) |
errorResponseLogLevel |
Log level for error responses. Any of OFF, DEBUG, INFO, WARN or ERROR Defaults to DEBUG. (Optional) |
extensions |
Collection of Extension to provide additional extensions when creating a connection factory. Defaults to empty. (Optional) |
fetchSize |
The default number of rows to return when fetching results. Defaults to 0 for unlimited. (Optional) |
forceBinary |
Whether to force binary transfer. Defaults to false. (Optional) |
hostRecheckTime |
Host status recheck time when using multi-server operations. Defaults to 10 seconds. (Optional) |
loadBalanceHosts |
Whether to shuffle the list of given hostnames before connect when using multi-server operations. Defaults to true. (Optional) |
loopResources |
TCP/Socket LoopResources (depends on the endpoint connection type). (Optional) |
lockWaitTimeout |
Lock wait timeout. (Optional) |
maxMessageSize |
Maximum size (in bytes) of a single protocol message/frame received from the server. Frames whose announced length exceeds this fail the connection instead of being buffered. Defaults to effectively unbounded. Keep it above the largest expected row or COPY chunk (field values may reach 1 GB). (Optional) |
noticeLogLevel |
Log level for error responses. Any of OFF, DEBUG, INFO, WARN or ERROR Defaults to DEBUG. (Optional) |
preferAttachedBuffers |
Configure whether codecs should prefer attached data buffers. The default is false, meaning that codecs will copy data from the input buffer into a byte array. Enabling attached buffers requires consumption of values such as Json to avoid memory leaks. |
preparedStatementCacheQueries |
Determine the number of queries that are cached in each connection. The default is -1, meaning there's no limit. The value of 0 disables the cache. Any other value specifies the cache size. |
options |
A Map of connection parameters. These are applied to each database connection created by the ConnectionFactory. Useful for setting generic [PostgreSQL connection parameters][psql-runtime-config]. (Optional) |
schema |
The search path to set. (Optional) |
No open issues yet, or sync has not completed.