https://github.com/pacman82/odbc-api
ODBC (Open Database Connectivity) bindings for Rust.
https://github.com/pacman82/odbc-api
odbc-api rust
Last synced: 26 days ago
JSON representation
ODBC (Open Database Connectivity) bindings for Rust.
- Host: GitHub
- URL: https://github.com/pacman82/odbc-api
- Owner: pacman82
- License: mit
- Created: 2020-08-14T18:22:37.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-04T17:16:48.000Z (about 1 month ago)
- Last Synced: 2025-05-04T17:36:56.454Z (about 1 month ago)
- Topics: odbc-api, rust
- Language: Rust
- Homepage:
- Size: 7.4 MB
- Stars: 158
- Watchers: 10
- Forks: 25
- Open Issues: 8
-
Metadata Files:
- Readme: Readme.md
- Changelog: CHANGELOG.md
- Contributing: Contributing.md
- Funding: .github/FUNDING.yml
- License: License
Awesome Lists containing this project
README
# ODBC-API
[](https://docs.rs/odbc-api/)
[](https://github.com/pacman82/odbc-api/blob/main/License)
[](https://crates.io/crates/odbc-api)
[](https://coveralls.io/github/pacman82/odbc-api?branch=main)Rust ODBC bindings. ODBC (Open Database Connectivity) is an open standard to connect to a variaty of data sources. Most data sources offer ODBC drivers. There are two typical usage scenarios for ODBC:
* Your appliciation is designed to work with a wide range of Databases without the need of redeploying it.
* There is no native Rust driver in suitable quality available for your Database so you want to use the ODBC driver instead.See also: [Is ODBC the Answer?](https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/is-odbc-the-answer)
This crate is currently tested against:
* Microsoft SQL Server
* PostgreSQL
* MariaDB
* SQLiteCurrent ODBC Version is `3.80`.
This crate is build on top of the `odbc-sys` ffi bindings, which provide definitions of the ODBC C Interface, but do not build any kind of abstraction on top of it.
## Usage
Check the [guide](https://docs.rs/odbc-api/latest/odbc_api/guide/index.html) for code examples and a tour of the features.
## Installation
To build this library you need to link against the `odbc` library of your systems ODBC driver manager. It should be automatically detected by the build. On Windows systems it is preinstalled. On Linux and OS-X [unix-odbc](http://www.unixodbc.org/) must be installed. To create a Connections to a data source, its ODBC driver must also be installed.
### Windows
Nothing to do. ODBC driver manager is preinstalled.
### Ubuntu
```shell
sudo apt-get install unixodbc-dev
```### macOS
You can use homebrew to install unixODBC
```shell
sudo brew install unixodbc
```**or**
You can use MacPorts to install it
```shell
sudo port install unixodbc
```**or**
You can also install unixODBC from source:
1. copy the unixODBC-2.3.9.tar.gz file somewhere you can create files and directories
2. gunzip unixODBC*.tar.gz
3. tar xvf unixODBC*.tar
4. `./configure`
5. `make`
6. `sudo make install`### Linux / OS-X via Nix Flakes
Alternatively, if you're familiar with the Nix ecosystem or want to try it out, [our wiki](https://github.com/pacman82/odbc-api/wiki) has a user contributed example on setting up a dev environment with Nix flakes.
## Features
* [x] Connect using Data Source names (DSN)
* [x] Connect using ODBC connection strings
* [x] Connect using prompts (windows)
* [x] Log ODBC diagnostics and warnings (via `log` crate).
* [x] Columnar bulk inserts.
* [x] Columnar bulk queries.
* [ ] Rowise bulk inserts.
* [x] Rowise bulk queries.
* [x] Output parameters of stored procedures.
* [x] prepared and 'one shot' queries.
* [x] Transactions
* [x] Pass parameters to queries
* [x] Asynchronous execution of one shot queries
* [ ] Asynchronous execution of prepared queries
* [ ] Asynchronous connecting to database
* [ ] Asynchronous fetching of Metainformation
* [x] Multithreading
* [x] Inserting large binary / text data in stream
* [x] Fetching arbitrary large text / binary data in stream
* [x] Connection pooling
* [x] List tables of data sources
* [x] Retrieve multiple result sets