diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 20485478..47625c5d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -54,7 +54,7 @@ jobs:
db_url: "mssql://root:Password123!@127.0.0.1/sqlpage"
- database: odbc
container: postgres
- db_url: "Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!"
+ db_url: "Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!"
setup_odbc: true
steps:
- uses: actions/checkout@v4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccf8bc1b..a4e00999 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- SQLPage now sets the [`Server-Timing` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Server-Timing) in development. So when you have a page that loads slowly, you can open your browser's network inspector, click on the slow request, then open the timing tab to understand where it's spending its time.
-
- Fixed a memory corruption issue in the builtin odbc driver manager
+ - ODBC: fix using globally installed system drivers by their name in debian-based linux distributions.
## v0.38.0
diff --git a/build.rs b/build.rs
index a39ea959..ed14c612 100644
--- a/build.rs
+++ b/build.rs
@@ -29,6 +29,7 @@ async fn main() {
] {
h.await.unwrap();
}
+ set_odbc_rpath();
}
fn make_client() -> awc::Client {
@@ -171,3 +172,14 @@ fn make_url_path(url: &str) -> PathBuf {
);
sqlpage_artefacts.join(filename)
}
+
+/// On debian-based linux distributions, odbc drivers are installed in /usr/lib/-linux-gnu/odbc
+/// which is not in the default library search path.
+fn set_odbc_rpath() {
+ if cfg!(all(target_os = "linux", feature = "odbc-static")) {
+ println!(
+ "cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/{}-linux-gnu/odbc",
+ std::env::var("TARGET").unwrap().split('-').next().unwrap()
+ );
+ }
+}