This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 8c2d93cc84 GH-49444: [C++][FlightRPC][ODBC] Disable DSN default values
on MacOS (#49402)
8c2d93cc84 is described below
commit 8c2d93cc841f91fc225dff4968a94015ed23c52d
Author: justing-bq <[email protected]>
AuthorDate: Mon Mar 9 16:49:26 2026 -0700
GH-49444: [C++][FlightRPC][ODBC] Disable DSN default values on MacOS
(#49402)
### Rationale for this change
iodbc driver manager on macOS treats default values as real values when
reading from system DSN, and the driver manager ignores the actual values.
* GitHub Issue: #49444
Lead-authored-by: justing-bq <[email protected]>
Co-authored-by: alinalibq <[email protected]>
Signed-off-by: David Li <[email protected]>
---
.../flight/sql/odbc/odbc_impl/config/configuration.cc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc
b/cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc
index 866749e7e0..0e49613979 100644
--- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc
+++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc
@@ -129,16 +129,29 @@ void Configuration::LoadDsn(const std::string& dsn) {
Set(FlightSqlConnection::TOKEN, ReadDsnString(dsn,
FlightSqlConnection::TOKEN));
Set(FlightSqlConnection::UID, ReadDsnString(dsn, FlightSqlConnection::UID));
Set(FlightSqlConnection::PWD, ReadDsnString(dsn, FlightSqlConnection::PWD));
- Set(FlightSqlConnection::USE_ENCRYPTION,
- ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION,
DEFAULT_ENABLE_ENCRYPTION));
Set(FlightSqlConnection::TRUSTED_CERTS,
ReadDsnString(dsn, FlightSqlConnection::TRUSTED_CERTS));
+#ifdef __APPLE__
+ // macOS iODBC treats non-empty defaults as the real values when reading
from system
+ // DSN, so we don't pass defaults on macOS.
+ // GH-49387 TODO: enable default values on macOS
+ Set(FlightSqlConnection::USE_ENCRYPTION,
+ ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION));
+ Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
+ ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE));
+ Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
+ ReadDsnString(dsn,
FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION));
+#else
+ // Windows and Linux
+ Set(FlightSqlConnection::USE_ENCRYPTION,
+ ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION,
DEFAULT_ENABLE_ENCRYPTION));
Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
DEFAULT_USE_CERT_STORE));
Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
DEFAULT_DISABLE_CERT_VERIFICATION));
+#endif
auto customKeys = ReadAllKeys(dsn);
RemoveAllKnownKeys(customKeys);