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
Databend | Java | Notes |
---|---|---|
Integers | ||
TINYINT | Byte | |
SMALLINT | Short | |
INT | Integer | |
BIGINT | Long | |
TINYINT UNSIGNED | Short | |
SMALLINT UNSIGNED | Integer | |
INT UNSIGNED | Long | |
BIGINT UNSIGNED | BigInteger | |
Floating Point | ||
FLOAT | Float | |
DOUBLE | Double | |
DECIMAL | BigDecimal | Precision preserved |
Other Types | ||
BOOLEAN | Boolean | |
STRING | String | |
DATE | Date | |
TIMESTAMP | Timestamp | |
ARRAY(T) | String | JSON encoded |
TUPLE(...) | String | JSON encoded |
MAP(K,V) | String | JSON encoded |
VARIANT | String | JSON encoded |
BITMAP | String | Base64 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
- Maven Central: databend-jdbc
- GitHub Repository: databend-jdbc
- JDBC Documentation: Oracle JDBC Guide