https://github.com/dbeaver/dbeaver-jdbc-libsql
LibSQL JDBC driver
https://github.com/dbeaver/dbeaver-jdbc-libsql
jdbc jdbc-driver libsql sqlite turso
Last synced: about 2 months ago
JSON representation
LibSQL JDBC driver
- Host: GitHub
- URL: https://github.com/dbeaver/dbeaver-jdbc-libsql
- Owner: dbeaver
- License: apache-2.0
- Created: 2024-10-27T13:48:36.000Z (8 months ago)
- Default Branch: devel
- Last Pushed: 2025-04-17T16:00:28.000Z (about 2 months ago)
- Last Synced: 2025-04-18T02:46:37.251Z (about 2 months ago)
- Topics: jdbc, jdbc-driver, libsql, sqlite, turso
- Language: Java
- Homepage:
- Size: 97.7 KB
- Stars: 58
- Watchers: 5
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# LibSQL JDBC driver
[](https://github.com/dbeaver/dbeaver-jdbc-libsql/actions/workflows/push-pr-devel.yml)
[](https://javadoc.io/doc/com.dbeaver.jdbc/com.dbeaver.jdbc.driver.libsql)
[](http://www.apache.org/licenses/LICENSE-2.0)Turso LibSQL [JDBC](https://en.wikipedia.org/wiki/JDBC_driver) is a library for accessing and managing [LibSQL](https://github.com/tursodatabase/libsql) databases in Java.
- It is a pure Java library
- Version 1.0 uses simple [HTTP API](https://github.com/tursodatabase/libsql/blob/main/docs/http_api.md) protocol for LibSQL
- It supports prepared statements, database metadata, resultsets, data types and most of other JDBC features
- It supports Turso and local LibSQL servers
- It is included in [DBeaver](https://github.com/dbeaver/dbeaver) and [CloudBeaver](https://github.com/dbeaver/cloudbeaver) as default LibSQL driver. However, it can be used in any other products/frameworks which rely on JDBC API## Reqirements
- Java 17
- Maven## Usage
JDBC URL format: `jdbc:dbeaver:libsql:`
Server URL is a full URL including schema and port. For example:
- `jdbc:dbeaver:libsql:http://localhost:1234`
- `jdbc:dbeaver:libsql:https://test-test.turso.io`Token based authentication supported in version 1.0. Pass token value as password, leave the username empty.
Driver class name: `com.dbeaver.jdbc.driver.libsql.LibSqlDriver`
## Example
```java
import java.sql.*;public class LibSqlTest {
public static void main(String[] args) throws Exception {
String databaseUrl = "http://libsql-server.company.local:8080";
String token = args[0];
try (Connection connection = DriverManager.getConnection("jdbc:dbeaver:libsql:" + databaseUrl, null, token)) {
try (Statement statement = connection.createStatement()) {
statement.execute("drop table if exists test_table_1");
statement.execute("create table test_table_1 (id integer, name string)");
statement.execute("insert into test_table_1 values(1, 'test one')");
statement.execute("insert into test_table_1 values(2, 'test two')");
try (ResultSet rs = statement.executeQuery("select * from test_table_1")) {
while (rs.next()) {
System.out.println(rs.getInt("id") + " = " + rs.getString("name"));
}
}
}
}
}
}
```
## LicenseLicensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
## Download
Download from Maven Central or from the releases page.
```xml
com.dbeaver.jdbc
com.dbeaver.jdbc.driver.libsql
1.0.2
```