Skip to main content

Java JDBC Driver for Databend

The official JDBC driver providing standard JDBC 4.0 compatibility for seamless integration with Java applications.

Installation

Maven

<dependency>
<groupId>com.databend</groupId>
<artifactId>databend-jdbc</artifactId>
<version>0.3.7</version>
</dependency>

Gradle

implementation 'com.databend:databend-jdbc:0.3.7'

Connection String: See Drivers Overview for DSN format and connection examples.


Key Features

  • JDBC 4.0 Compatible: Standard JDBC interface support
  • Connection Pooling: Built-in connection management
  • Prepared Statements: Efficient parameterized queries
  • Batch Operations: Bulk insert and update supportations

Data Type Mappings

DatabendJavaNotes
Integers
TINYINTByte
SMALLINTShort
INTInteger
BIGINTLong
TINYINT UNSIGNEDShort
SMALLINT UNSIGNEDInteger
INT UNSIGNEDLong
BIGINT UNSIGNEDBigInteger
Floating Point
FLOATFloat
DOUBLEDouble
DECIMALBigDecimalPrecision preserved
Other Types
BOOLEANBoolean
STRINGString
DATEDate
TIMESTAMPTimestamp
ARRAY(T)StringJSON encoded
TUPLE(...)StringJSON encoded
MAP(K,V)StringJSON encoded
VARIANTStringJSON encoded
BITMAPStringBase64 encoded

Basic Usage

import java.sql.*;

// Connect to Databend
Connection conn = DriverManager.getConnection("<your-dsn>");

// DDL: Create table
Statement stmt = conn.createStatement();
stmt.execute("CREATE TABLE users (id INT, name STRING, email STRING)");

// Write: Insert data
PreparedStatement pstmt = conn.prepareStatement("INSERT INTO users VALUES (?, ?, ?)");
pstmt.setInt(1, 1);
pstmt.setString(2, "Alice");
pstmt.setString(3, "alice@example.com");
pstmt.executeUpdate();

// Query: Select data
ResultSet rs = stmt.executeQuery("SELECT id, name, email FROM users WHERE id = 1");
while (rs.next()) {
System.out.println("User: " + rs.getInt("id") + ", " +
rs.getString("name") + ", " +
rs.getString("email"));
}

// Close connections
rs.close();
stmt.close();
pstmt.close();
conn.close();

Configuration Reference

For complete databend-jdbc driver configuration options including:

  • Connection string parameters
  • SSL/TLS configuration
  • Authentication methods
  • Performance tuning parameters

Please refer to the official databend-jdbc Connection Guide.

Resources

Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today