CrateDB JDBC Driver

Table of contents

Introduction

A JDBC driver for CrateDB, based on the PostgreSQL JDBC Driver. It can be used with CrateDB version 0.38.0 and newer.

This is a JDBC Type 4 driver, adhering to the JDBC 4.1 specification. It is written in pure Java, and communicates with the database using the PostgreSQL Wire Protocol.

JDBC is a standard Java API that provides common interfaces for accessing databases in Java.

Synopsis

Connect to CrateDB instance running on localhost.

import java.sql.Connection;
import java.sql.DriverManager;

Connection conn = DriverManager.getConnection("jdbc:crate://localhost:5432/");

Connect to CrateDB Cloud.

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

Properties connectionProps = new Properties();
connectionProps.put("user", "admin");
connectionProps.put("password", "<PASSWORD>");
connectionProps.put("tcpKeepAlive", true);

Connection conn = DriverManager.getConnection("jdbc:crate://example.aks1.westeurope.azure.cratedb.net:5432/?user=crate", connectionProps);

Documentation

For general help about JDBC, please consult the JDBC tutorial and the JDBC API documentation.

Examples

Project information

Resources

Contributions

The CrateDB JDBC driver library is an open source project, and is managed on GitHub. Every kind of contribution, feedback, or patch, is much welcome. Create an issue or submit a patch if you think we should include a new feature, or to report or fix a bug.

Development

In order to setup a development environment on your workstation, please head over to the development sandbox documentation. When you see the software tests succeed, you should be ready to start hacking.

License

The project is licensed under the terms of the Apache 2.0 license, like CrateDB itself, see LICENSE.