- Notifications
You must be signed in to change notification settings - Fork21
FFI (Foreign Function Interface) bindings for ODBC (Open Database Connectivity) for Rust.
License
pacman82/odbc-sys
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
FFI (Foreign Function Interface) bindings for ODBC (Open Database Connectivity)As ffi bindings to C-APIs are low level by nature this library is intended to be the foundation ofother libraries to build on top, rather than to be used directly.
- Providing declarations of ODBC Symbols compatible to the C-Interface of an ODBC Driver Manager
- Provide correct definition of symbols for Unix and Windows in either 32Bit or 64Bit flavour
- Not to abstract away any power of the underlying API
- Increase type safety where feasible
- As it is as of now unlikely to happen that anyone is writing ODBC 2.0 applications in Rusttherefore deprecated symbols like 'SQLAllocEnv' have been left out intentionally.
This library will link againstodbc32.dll
(preinstalled) on Windows systems. On Linux and macOS it links againstlibodbc.so
by default. This is typically provided byunix-odbc. Using the--feature iodbc
you can also link againstlibiodbc.so
. This may be interesting if you are trying to connect to some older data sources on macOS.
Use your systems packet manager to installunixodbc-dev
. E.g. on Ubuntu / Debian
sudo apt install unixodbc-dev
On Intel based architectures you can installunix-odbc
using homebrew.
brew install unixodbc
Note forARM based macOS Systems (M1 processors and later):
cargo build
is not going to pick uplibodbc.so
installed via homebrew due to the fact that homebrew on ARM Mac installs into/opt/homebrew/Cellar
as opposed to/usr/local/opt/
.
You find documentation on what directories are searched during build here:https://doc.rust-lang.org/cargo/reference/environment-variables.html#dynamic-library-paths.
You can also install unixODBC from source:
- copy the unixODBC-2.3.9.tar.gz file somewhere you can create files and directories
- gunzip unixODBC*.tar.gz
- tar xvf unixODBC*.tar
./configure
make
make install
Thanks to @TBPixel for testing this!
As windows does ship with ODBC preinstalled, you are good to go out of the box.
Symbols are added to this library as we go along implementing uses cases in higher level APIs. If you miss something please do not hesitate to contribute.
Thanks to the folks ofdocs.rs for building and hosting thedocumentation!
Want to help out? Just create an issue or pull request.
About
FFI (Foreign Function Interface) bindings for ODBC (Open Database Connectivity) for Rust.