Drivers & Client Libraries
At CrateDB, we believe in breaking down barriers (technical, temporal and procedural) so your business can harness the full potential of its data. With CrateDB’s real-time analytics engine, you can act with speed and precision. One of the key enablers of this capability is the wide support for drivers and client libraries, making it easy for developers across languages and frameworks to connect, query and analyze data.
Why choose CrateDB drivers?
- Language-agnostic connectivity: Whether you use Java, Python, .NET, Node.js or Go, CrateDB provides first-class drivers and libraries that speak your language.
- Full SQL support: These libraries connect via the PostgreSQL Wire Protocol or HTTP/REST endpoint, enabling you to leverage CrateDB’s full power (real-time analytics, distributed joins, search, vector operations) without limiting yourself to a narrow interface.
- Developer-friendly: Easy installation, familiar APIs, and documentation tailored for each environment, so you spend less time integrating and more time building.
- Seamless scalability: Because CrateDB is designed for real-time, large-scale analytics on structured, semi-structured and unstructured data, the drivers are built to perform under scale, letting you focus on analytics, not plumbing.
What drivers are available?
Here’s a quick overview of popular drivers and their key features:
| Language / Platform | Driver / Library | Highlights |
|---|---|---|
| Java | JDBC driver | Based on PostgreSQL JDBC, pure Java, enables use via standard java.sql ecosystem. |
| Python | crate client library |
Implements Python DB API 2.0 spec; install via pip install crate. |
| Node.js | node-crate (or REST interface) |
Connects via HTTP/REST _sql endpoint; ideal for JavaScript/TypeScript applications. |
| Go, .NET, PHP, … | Adapters & connectors | Available via ecosystem (via PostgreSQL-wire or HTTP/REST) as noted in the “Drivers & Tools” reference. |
Getting started: example (Python)
pip install crate
from crate import client
connection = client.connect("http://localhost:4200", username="user", password="pwd")
cursor = connection.cursor()
cursor.execute("SELECT col1, count(*) FROM my_table GROUP BY col1")
for row in cursor:
print(row)
Best practices for drivers & clients
-
Use the correct protocol: For high-performance workloads you might prefer the PostgreSQL Wire Protocol drivers (e.g., JDBC, standard PostgreSQL clients). For flexible HTTP/REST access (e.g., serverless functions, scripts, polyglot environments) you can use the HTTP endpoint + clients.
-
Configure connection pooling wisely: Especially in production environments with many concurrent queries, ensure your client library supports pooling or reuse of connections for low latency.
-
Leverage async or batch features: Where supported (especially in Go, Node.js, Python), use asynchronous query execution or bulk insert/updates to handle high-throughput ingestion or export workflows.
-
Monitor driver health and compatibility: Keep your client library versions aligned with the CrateDB server version; monitor for driver updates and compatibility releases.
-
Secure your connections: Always use TLS/HTTPS or encrypted wire protocol when connecting across networks; manage credentials, roles and tokens with care.
When to use which client / driver
-
Use a native driver (e.g., JDBC for Java, Python
cratelib) when you need full-featured access, complex query support, connection pooling and integration into complex applications. -
Use the HTTP/REST interface (via generic HTTP library or lightweight client) when you need language-agnostic access, microservices, event triggers, or simple query layers.
-
Use ODBC or generic PostgreSQL clients if you have existing tools (BI dashboards, ETL frameworks) built against PostgreSQL-compatible drivers—you can point them to CrateDB thanks to its PostgreSQL wire compatibility
CrateDB architecture guide
This comprehensive guide covers all the key concepts you need to know about CrateDB's architecture. It will help you gain a deeper understanding of what makes it performant, scalable, flexible and easy to use. Armed with this knowledge, you will be better equipped to make informed decisions about when to leverage CrateDB for your data projects.
