百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rdbc

> 数据库
开源

Rust 数据库连接 (RDBC) :: 数据库驱动程序的通用 Rust API

584 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Rust 数据库连接 (RDBC) :: 数据库驱动程序的通用 Rust API

Rust DataBase Connectivity (RDBC)

Love them or hate them, the ODBC and JDBC standards have made it easy to use a wide range of desktop and server products with many different databases thanks to the availability of database drivers implementing these standards.

This project provides a Rust equivalent API as well as reference implementations (drivers) for Postgres, MySQL, and SQLite. There is also an RDBC-ODBC driver being developed, that will allow ODBC drivers to be called via the RDBC API, so that it is also possible to connect to databases that do not yet have Rust drivers available.

Note that the provided RDBC drivers are just wrappers around existing database driver crates and this project is not attempting to build new drivers from scratch but rather make it possible to leverage existing drivers through a common API.

Why do we need this when we have Diesel?

This is filling a different need. I love the Diesel approach for building applications but if you are building a generic SQL tool, a business intelligence tool, or a distributed query engine, there is a need to connect to different databases and execute arbitrary SQL. This is where we need a standard API and available drivers.

RDBC API PoC

Note that the design of the RDBC API is intentionally modeled directly after ODBC and JDBC (except that indices are 0-based rather than 1-based) and that is likely to change to make this more idiomatic for Rust.

There is currently no async support and that will be addressed soon.

There are also design flaws with the current design, such as the limitation of only being able to create one prepared statement per connection.

Work is in progress of the next iteration of this project and there will definitely be breaking changes.

…

Examples

Execute a Query

rust
let driver: Arc = Arc::new(PostgresDriver::new());
let mut conn = driver.connect("postgres://user:[email protected]:5433")?;
let mut stmt = conn.prepare("SELECT a FROM test")?;
let mut rs = stmt.execute_query(&vec![])?;
while rs.next() {
  println!("{:?}", rs.get_string(1)?);
}

Current Status

This is just an experimental PoC and is not currently suitable for anything. However, I do intend to make it useful pretty quickly and I am tracking issues here.

The immediate priorities though are:

  • Announce project and get initial feedback
  • Support parameterized queries
  • Support prepared statements
  • Implement simple SQL console CLI
  • Design for async
  • Support connection pooling
  • Implement comprehensive unit and integration tests
  • Add support for more data types
  • Implement RDBC-ODBC bridge
  • Implement dynamic loading of drivers at runtime

License

RDBC is licensed under Apache Licence, Version 2.0.

Contributing

Please refer to the contributors guide before contributing to this project and for information on building and testing locally.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustdatabasedrivermysqlodbc

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库