Skip to content

Repository files navigation

turborel

turborel-java is in alpha, meaning, version 0.0.0. Its version is the number of the Turborel release it is made for, and the alpha is made for Turborel 0.0.0, which speaks protocol version 1. Anything may change from one build to the next, API and behaviour alike. See VERSIONING.md. The latest Turborel alpha is built for Linux, macOS and Windows as the pre-release nightly, and as the image ghcr.io/turborel/turborel:nightly.

turborel-java is the Java driver for Turborel, a relational database system. It connects a Java program to a Turborel server, turboreld, over Turborel's native protocol, version 1, which it speaks itself, in Java alone, with no native code and no library beyond the JDK.

Its standard interface is JDBC 4.3, as the JPMS module com.turborel.jdbc. Beneath it is a low-level client built to do all that Turborel's own client library, turborel-client, does: TCP, Unix sockets and Windows named pipes, TLS 1.3, the server's certificate verified by default, with its key exchange groups chosen, a client certificate from a file or held in memory, SCRAM-SHA-256 and SCRAM-SHA-256-PLUS, the database and role a connection names, prepared statements and cursors, large objects, bulk copy (by column, where the server grants it), import and export, settings from a URI, the environment and service and password files, several servers, pipelines and pools, and the routine debugger (extension).

The driver is built in milestones, M0 to M8. Its low-level client connects, runs and prepares statements, controls its session, reads and writes large objects, copies, imports and exports rows, and connects by settings to one of several servers, pipelines requests, pools connections and holds an SQL-agent's named connections; and over it JDBC 4.3's driver, connections, statements, result sets and metadata serve programs and database tools, DBeaver and DataGrip among them; a connection closed with a transaction open rolls it back first. What JDBC has no place for, as the routine debugger, is the driver's own interface, reached through TurborelConnection. CONFORMANCE.md shows what is done, row by row, and TODO.md what is open.

Requirements

  • Java 17 or later, on Linux, macOS or Windows (RULES.md D3).
  • Java 17, 21 and 25 are tested; the jar runs on the class path too.
  • A Turborel server of the same release, which speaks protocol version 1 (running the server).

Installing

No package is published yet. The driver's package, com.turborel:turborel-jdbc, goes to Maven Central only once every Turborel driver is done, with the others (VERSIONING.md). Until then, build the driver from source:

git clone https://github.com/turborel/turborel-java.git
cd turborel-java
./gradlew build

The jar is build/libs/turborel-jdbc-0.0.0.jar, for the class path or the module path. The build needs JDK 17 and JDK 21 (RULES.md D10); if Gradle does not find them, name their homes with -Dorg.gradle.java.installations.paths=<jdk17>,<jdk21>.

A first query

Through JDBC, as any driver is used; the driver is found by its jdbc:turborel: URLs (Installing).

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

try (Connection conn = DriverManager.getConnection(
                "jdbc:turborel://db.example:7422/?tls_mode=verify-full", "ANN", "ann's");
        PreparedStatement stmt = conn.prepareStatement(
                "SELECT ID, NAME FROM STAFF WHERE ID < ? ORDER BY ID")) {
    stmt.setInt(1, 3);
    try (ResultSet rows = stmt.executeQuery()) {
        while (rows.next()) {
            System.out.println(rows.getInt("ID") + " " + rows.getString("NAME"));
        }
    }
}

The manual

doc/ is the manual: a User's Guide, an API Reference and Appendices, published at https://turborel.com/docs/drivers/java/. Each chapter is written as the milestone that fills it lands. The SQL a program sends, and the server, are described in Turborel's own manual, Turborel Documentation. VERSIONING.md tells how the driver's releases are numbered and published.

Contributing

Read CONTRIBUTING.md before making a change: how a change is made, its commit message, pull requests and issues. Every change passes ./gradlew check. RULES.md says how the driver is designed, written and verified, CONFORMANCE.md is the parity matrix every Turborel driver keeps, and TODO.md lists open work.

Security

Report a vulnerability privately, never in a public issue, as SECURITY.md says.

License and trademark

The code is under the BSD-2-Clause Plus Patent License, in LICENSE. The name Turborel and its logos are not: TRADEMARK.md says how they may be used.