CompanyMarch 21, 2019

Introducing Java Driver 4

Introducing Java Driver 4

The Java driver team is pleased to announce the general availability of two new major versions: OSS driver 4.0.0 and DSE driver 2.0.0.

These are long-awaited versions that address longstanding issues with the 3.x line:

  • drop the dependency to Guava, and update the API to use Java 8 futures;
  • make the driver more pluggable and better expose the internals;
  • clean up the codebase and make it more modular.

Java Driver 4.0

This required a major redesign of the architecture, which results in API changes that are not backward-compatible with previous versions.

These releases also come with many improvements and new features:

  • Generalized use of interfaces in the public API, backed by immutable implementations;
  • New configuration mechanism that doesn't require rebuilding your application to change parameters;
  • Support for execution profiles, to capture common set of options for different categories of requests;
  • Unified top-level session component, that can be initialized in one step (no more Cluster), with improved protocol negotiation in mixed clusters, reconnection at startup, and built-in request throttling;
  • Simplified load balancing: a single policy out of the box, that implements the best practices;
  • True global request timeout;
  • Driver-side cache of prepared statements, that gracefully handles preparing the same query multiple times;
  • Improved ResultSet API, removing the dangerous methods that could accidentally trigger a blocking background fetch during asynchronous iteration;
  • Improved metrics, that can be enabled or disabled individually, and expose per-node information;
  • Improved metadata, with atomic updates and filtering features to limit CPU usage;
  • Better handling of case-sensitivity in CQL identifiers;
  • New pluggable request execution model that makes the driver even more extensible.

In addition, the DSE driver provides additional features to address the needs of our enterprise customer deployments:

  • Brand-new reactive-style query execution model;
  • Improved load balancing policy with a highly efficient "slow node avoidance" algorithm.

All these topics are covered in detail in our upgrade guide, where you'll also find links to the rest of our online manual for a deep dive on specific topics.

Note that the object mapper is not ported yet; we are actively working on it and plan to release it with OSS 4.1.0 / DSE 2.1.0 (see JAVA-2078).

The drivers are available from Maven Central as usual, but note that the OSS driver has new coordinates, and the Query Builder now resides in a separate artifact.

<dependency>
 <groupId>com.datastax.oss</groupId>
 <artifactId>java-driver-core</artifactId>
 <version>4.0.0</version>
</dependency>


<dependency>
 <groupId>com.datastax.oss</groupId>
 <artifactId>java-driver-query-builder</artifactId>
 <version>4.0.0</version>
</dependency>


<dependency>
 <groupId>com.datastax.dse</groupId>
 <artifactId>dse-java-driver-core</artifactId>
 <version>2.0.0</version>
</dependency>


<dependency>
 <groupId>com.datastax.dse</groupId>
 <artifactId>dse-java-driver-query-builder</artifactId>
 <version>2.0.0</version>
</dependency>

You can also download the drivers from our download servers here.

One-Stop Data API for Production GenAI

Astra DB gives developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.