DATABASES Signal 469
New Modern JDBC Driver for PostgreSQL
Illustration only Photo by Tyler on Unsplash
Sehrope Sarkini has written a new PostgreSQL JDBC driver from scratch that prioritizes PostgreSQL's native wire protocol over JDBC's lowest-common-denominator abstraction, uses Java 21 virtual threads for I/O, and streams results by default through a pull cursor.
This driver gives Java engineers working with PostgreSQL a native API that exposes the database's full feature set directly, rather than filtering everything through JDBC's cross-database abstraction. The virtual-thread architecture on Java 21 eliminates the traditional tradeoff between async APIs and thread-per-connection models, making the driver both performant and straightforward to reason about.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
The native API is designed around PostgreSQL's wire protocol and feature set rather than JDBC's lowest common denominator, with JDBC compliance built as a layer on top.
The driver uses Java 21 virtual threads with ReentrantLock instead of synchronized blocks to avoid pinning carrier threads, enabling thousands of connections without async or callback APIs.
Query results stream by default through a pull cursor that reads only enough data for the next row, with forEach, map, and collect built as adapters on top.
THE CLUSTER