8 releases

0.2.2 Apr 28, 2023
0.2.1 Apr 28, 2023
0.1.3 Apr 17, 2023
0.1.0 Mar 29, 2023
0.0.1 Mar 11, 2023

#1895 in Database interfaces

Download history 23/week @ 2024-07-24 6/week @ 2024-07-31 2/week @ 2024-08-28 9/week @ 2024-09-18 9/week @ 2024-09-25 2/week @ 2024-10-02

70 downloads per month
Used in colink

MIT license

18KB
373 lines

Rust DataBase Connectivity (RDBC)

This is a Rust implementation of the Java DataBase Connectivity (JDBC) API, a continuation and reimplementation of the rdbc project.

Goals

  • Provide a common API for accessing relational databases in Rust.

Usage

Installation

Add the following to your Cargo.toml:

[dependencies]
rdbc2 = "0.2"

Example

use rdbc2;

let mut database = rdbc2::dbc::Database::new(<database_url>)?;

let result = database.execute_query(<query_string>)?;
let serialized_result = database.execute_query_and_serialize(<query_string>)?; // Serializes the result into a JSON string
let serialized_result_raw = database.execute_query_and_serialize_raw( < query_string>)?; // Serializes the result into an u8 array

// Or with parameters
let result = database.execute_query_with_params( < query_string>, < params>)?;
let serialized_result = database.execute_query_and_serialize_with_params(<query_string>, <params>)?;

Supported Databases

  • MySQL
  • SQLite
  • PostgreSQL

Dependencies

~42–57MB
~1M SLoC