From fc525bfad5bb0b5c3c92353277c6a86c27c6a52e Mon Sep 17 00:00:00 2001 From: Victor Tsang Date: Thu, 4 Sep 2025 10:34:17 -0700 Subject: [PATCH 1/5] added setup script for mac and platform folders updated read me windows file path updated windows folder related file paths added license --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 8 +- cpp/src/arrow/flight/sql/odbc/README | 4 +- .../sql/odbc/install/mac/install_odbc_ini.sh | 105 ++++++++++++++++++ .../arrow-flight-sql-odbc-patch.xml | 0 .../{ => windows}/arrow-flight-sql-odbc.wxs | 0 .../{ => windows}/arrow-wix-banner.bmp | Bin .../install/{ => windows}/versioninfo.rc.in | 0 7 files changed, 111 insertions(+), 6 deletions(-) create mode 100755 cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh rename cpp/src/arrow/flight/sql/odbc/install/{ => windows}/arrow-flight-sql-odbc-patch.xml (100%) rename cpp/src/arrow/flight/sql/odbc/install/{ => windows}/arrow-flight-sql-odbc.wxs (100%) rename cpp/src/arrow/flight/sql/odbc/install/{ => windows}/arrow-wix-banner.bmp (100%) rename cpp/src/arrow/flight/sql/odbc/install/{ => windows}/versioninfo.rc.in (100%) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 5a43a1bfdb0..0d50ee31e36 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -58,7 +58,7 @@ if(WIN32) set(VER_COMPANYNAME_STR ${ODBC_PACKAGE_VENDOR}) set(VER_PRODUCTNAME_STR ${ODBC_PACKAGE_NAME}) - configure_file("install/versioninfo.rc.in" "install/versioninfo.rc" @ONLY) + configure_file("install/windows/versioninfo.rc.in" "install/versioninfo.rc" @ONLY) list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def install/versioninfo.rc) endif() @@ -136,11 +136,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) PATTERN "zlib1.dll") set(CPACK_WIX_EXTRA_SOURCES - "${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc.wxs") + "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-flight-sql-odbc.wxs") set(CPACK_WIX_PATCH_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-flight-sql-odbc-patch.xml") + "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-flight-sql-odbc-patch.xml") - set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/arrow-wix-banner.bmp") + set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp") endif() get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) diff --git a/cpp/src/arrow/flight/sql/odbc/README b/cpp/src/arrow/flight/sql/odbc/README index 7cd53778337..b26b660a638 100644 --- a/cpp/src/arrow/flight/sql/odbc/README +++ b/cpp/src/arrow/flight/sql/odbc/README @@ -30,9 +30,9 @@ After the build succeeds, the ODBC DLL will be located in i. `cd to repo.` ii. `cd ` iii. Run script to register your ODBC DLL as Apache Arrow Flight SQL ODBC Driver - `.\cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd \cpp\build\< release | debug >\< Release | Debug>\arrow_flight_sql_odbc.dll` + `.\cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd \cpp\build\< release | debug >\< Release | Debug>\arrow_flight_sql_odbc.dll` Example command for reference: - `.\cpp\src\arrow\flight\sql\odbc\install\install_amd64.cmd C:\path\to\arrow\cpp\build\release\Release\arrow_flight_sql_odbc.dll` + `.\cpp\src\arrow\flight\sql\odbc\tests\install_odbc.cmd C:\path\to\arrow\cpp\build\release\Release\arrow_flight_sql_odbc.dll` If the registration is successful, then Apache Arrow Flight SQL ODBC Driver should show as an available ODBC driver in the x64 ODBC Driver Manager. diff --git a/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh new file mode 100755 index 00000000000..a8911042897 --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh @@ -0,0 +1,105 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +PREFIX="/Library/Apache/ArrowFlightSQLODBC" +USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini" +USER_ODBC_FILE="$HOME/Library/ODBC/odbc.ini" +DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver" +DSN_NAME="Apache Arrow Flight SQL ODBC DSN" + +touch "$USER_ODBCINST_FILE" +touch "$USER_ODBC_FILE" + +if [ $EUID -ne 0 ]; then + echo "Please run this script with sudo" + exit 1 +fi + +if grep -q "^\[$DRIVER_NAME\]" "$USER_ODBCINST_FILE"; then + echo "Driver [$DRIVER_NAME] already exists in odbcinst.ini" +else + echo "Adding [$DRIVER_NAME] to odbcinst.ini..." + echo " +[$DRIVER_NAME] +Description=An ODBC Driver for Apache Arrow Flight SQL +Driver=/Library/Apache/ArrowFlightSQLODBC/lib/libarrow_flight_sql_odbc.dylib +" >> "$USER_ODBCINST_FILE" +fi + +# Check if [ODBC Drivers] section exists +if grep -q '^\[ODBC Drivers\]' "$USER_ODBCINST_FILE"; then + # Section exists: check if driver entry exists + if ! grep -q "^${DRIVER_NAME}=" "$USER_ODBCINST_FILE"; then + # Driver entry does not exist, add under [ODBC Drivers] + sed -i '' "/^\[ODBC Drivers\]/a\\ +${DRIVER_NAME}=Installed +" "$USER_ODBCINST_FILE" + fi +else + # Section doesn't exist, append both section and driver entry at end + { + echo "" + echo "[ODBC Drivers]" + echo "${DRIVER_NAME}=Installed" + } >> "$USER_ODBCINST_FILE" +fi + +if grep -q "^\[$DSN_NAME\]" "$USER_ODBC_FILE"; then + echo "DSN [$DSN_NAME] already exists in $USER_ODBC_FILE" +else + echo "Adding [$DSN_NAME] to $USER_ODBC_FILE..." + cat >> "$USER_ODBC_FILE" < "${USER_ODBC_FILE}.tmp" && mv "${USER_ODBC_FILE}.tmp" "$USER_ODBC_FILE" + fi +else + # Section doesn't exist, append section and DSN entry at end + { + echo "" + echo "[ODBC Data Sources]" + echo "${DSN_NAME}=${DRIVER_NAME}" + } >> "$USER_ODBC_FILE" +fi + diff --git a/cpp/src/arrow/flight/sql/odbc/install/arrow-flight-sql-odbc-patch.xml b/cpp/src/arrow/flight/sql/odbc/install/windows/arrow-flight-sql-odbc-patch.xml similarity index 100% rename from cpp/src/arrow/flight/sql/odbc/install/arrow-flight-sql-odbc-patch.xml rename to cpp/src/arrow/flight/sql/odbc/install/windows/arrow-flight-sql-odbc-patch.xml diff --git a/cpp/src/arrow/flight/sql/odbc/install/arrow-flight-sql-odbc.wxs b/cpp/src/arrow/flight/sql/odbc/install/windows/arrow-flight-sql-odbc.wxs similarity index 100% rename from cpp/src/arrow/flight/sql/odbc/install/arrow-flight-sql-odbc.wxs rename to cpp/src/arrow/flight/sql/odbc/install/windows/arrow-flight-sql-odbc.wxs diff --git a/cpp/src/arrow/flight/sql/odbc/install/arrow-wix-banner.bmp b/cpp/src/arrow/flight/sql/odbc/install/windows/arrow-wix-banner.bmp similarity index 100% rename from cpp/src/arrow/flight/sql/odbc/install/arrow-wix-banner.bmp rename to cpp/src/arrow/flight/sql/odbc/install/windows/arrow-wix-banner.bmp diff --git a/cpp/src/arrow/flight/sql/odbc/install/versioninfo.rc.in b/cpp/src/arrow/flight/sql/odbc/install/windows/versioninfo.rc.in similarity index 100% rename from cpp/src/arrow/flight/sql/odbc/install/versioninfo.rc.in rename to cpp/src/arrow/flight/sql/odbc/install/windows/versioninfo.rc.in From c3ddd63dc911ae1b82113df2451a6b450a468dc8 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Fri, 21 Nov 2025 14:35:37 -0800 Subject: [PATCH 2/5] Add TODO note and update DSN --- .../sql/odbc/install/mac/install_odbc_ini.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh index a8911042897..129ed585751 100755 --- a/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh +++ b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh @@ -17,6 +17,9 @@ # specific language governing permissions and limitations # under the License. +# GH-47876 TODO: create macOS ODBC Installer +# Script for installing macOS ODBC driver, to be used for macOS installer. + PREFIX="/Library/Apache/ArrowFlightSQLODBC" USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini" USER_ODBC_FILE="$HOME/Library/ODBC/odbc.ini" @@ -67,13 +70,12 @@ else cat >> "$USER_ODBC_FILE" < Date: Mon, 24 Nov 2025 13:29:50 -0800 Subject: [PATCH 3/5] Update install_odbc_ini.sh This script depends on the ODBC install script. --- .../sql/odbc/install/mac/install_odbc_ini.sh | 41 ++++--------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh index 129ed585751..cfc9729ed7e 100755 --- a/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh +++ b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc_ini.sh @@ -17,16 +17,20 @@ # specific language governing permissions and limitations # under the License. -# GH-47876 TODO: create macOS ODBC Installer +# GH-47876 TODO: create macOS ODBC Installer. # Script for installing macOS ODBC driver, to be used for macOS installer. -PREFIX="/Library/Apache/ArrowFlightSQLODBC" -USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini" +source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +odbc_install_script="${source_dir}/install_odbc.sh" + +chmod +x "$odbc_install_script" +. "$odbc_install_script" /Library/Apache/ArrowFlightSQLODBC/lib/libarrow_flight_sql_odbc.dylib + USER_ODBC_FILE="$HOME/Library/ODBC/odbc.ini" DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver" DSN_NAME="Apache Arrow Flight SQL ODBC DSN" -touch "$USER_ODBCINST_FILE" touch "$USER_ODBC_FILE" if [ $EUID -ne 0 ]; then @@ -34,35 +38,6 @@ if [ $EUID -ne 0 ]; then exit 1 fi -if grep -q "^\[$DRIVER_NAME\]" "$USER_ODBCINST_FILE"; then - echo "Driver [$DRIVER_NAME] already exists in odbcinst.ini" -else - echo "Adding [$DRIVER_NAME] to odbcinst.ini..." - echo " -[$DRIVER_NAME] -Description=An ODBC Driver for Apache Arrow Flight SQL -Driver=/Library/Apache/ArrowFlightSQLODBC/lib/libarrow_flight_sql_odbc.dylib -" >> "$USER_ODBCINST_FILE" -fi - -# Check if [ODBC Drivers] section exists -if grep -q '^\[ODBC Drivers\]' "$USER_ODBCINST_FILE"; then - # Section exists: check if driver entry exists - if ! grep -q "^${DRIVER_NAME}=" "$USER_ODBCINST_FILE"; then - # Driver entry does not exist, add under [ODBC Drivers] - sed -i '' "/^\[ODBC Drivers\]/a\\ -${DRIVER_NAME}=Installed -" "$USER_ODBCINST_FILE" - fi -else - # Section doesn't exist, append both section and driver entry at end - { - echo "" - echo "[ODBC Drivers]" - echo "${DRIVER_NAME}=Installed" - } >> "$USER_ODBCINST_FILE" -fi - if grep -q "^\[$DSN_NAME\]" "$USER_ODBC_FILE"; then echo "DSN [$DSN_NAME] already exists in $USER_ODBC_FILE" else From aeea1a8eda6a8219d752bdb20b074df2e2a90400 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Wed, 26 Nov 2025 13:08:35 -0800 Subject: [PATCH 4/5] Add install ODBC script --- cpp/src/arrow/flight/sql/odbc/README | 21 ++++++ .../sql/odbc/install/mac/install_odbc.sh | 74 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100755 cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh diff --git a/cpp/src/arrow/flight/sql/odbc/README b/cpp/src/arrow/flight/sql/odbc/README index b26b660a638..3c4d5a9d386 100644 --- a/cpp/src/arrow/flight/sql/odbc/README +++ b/cpp/src/arrow/flight/sql/odbc/README @@ -44,6 +44,27 @@ should show as an available ODBC driver in the x64 ODBC Driver Manager. If the generation is successful, you will find `Apache Arrow Flight SQL ODBC--win64.msi` generated under the `build` folder. +## Steps to Register the 64-bit Apache Arrow ODBC driver on macOS + +After the build succeeds, the ODBC DLL will be located in +`build\debug` for a debug build and `build\release` for a release build. + +1. Open terminal shell. + +2. Register your ODBC DYLIB: + Need to replace with actual path to repository in the commands. + + i. `cd to repo.` + ii. `cd ` + iii. Give script permission to execute + `chmod +x cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh` + iv. Run script with `sudo` to register your ODBC DYLIB as Apache Arrow Flight SQL ODBC Driver + `sudo cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh /cpp/build/< release | debug >/libarrow_flight_sql_odbc.dylib` + Example command for reference: + `sudo cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh /path/to/arrow/cpp/build/release/libarrow_flight_sql_odbc.dylib` + +If the registration is successful, then Apache Arrow Flight SQL ODBC Driver +should be shown at `~/Library/ODBC/odbcinst.ini` ## Steps to Enable Logging Arrow Flight SQL ODBC driver uses Arrow's internal logging framework. By default, the log messages are printed to the terminal. diff --git a/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh new file mode 100755 index 00000000000..843255bec82 --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Used by macOS ODBC installer script and macOS ODBC testing + +ODBC_64BIT="$1" + +if [[ -z "$ODBC_64BIT" ]]; then + echo "error: 64-bit driver is not specified. Call format: install_odbc abs_path_to_64_bit_driver" + exit 1 +fi + +if [ ! -f $ODBC_64BIT ]; then + echo "64-bit driver can not be found: $ODBC_64BIT" + echo "Call format: install_odbc abs_path_to_64_bit_driver" + exit 1 +fi + +USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini" +DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver" +DSN_NAME="Apache Arrow Flight SQL ODBC DSN" + +touch "$USER_ODBCINST_FILE" + +# Admin privilege is needed to add ODBC driver registration +if [ $EUID -ne 0 ]; then + echo "Please run this script with sudo" + exit 1 +fi + +if grep -q "^\[$DRIVER_NAME\]" "$USER_ODBCINST_FILE"; then + echo "Driver [$DRIVER_NAME] already exists in odbcinst.ini" +else + echo "Adding [$DRIVER_NAME] to odbcinst.ini..." + echo " +[$DRIVER_NAME] +Description=An ODBC Driver for Apache Arrow Flight SQL +Driver=$ODBC_64BIT +" >> "$USER_ODBCINST_FILE" +fi + +# Check if [ODBC Drivers] section exists +if grep -q '^\[ODBC Drivers\]' "$USER_ODBCINST_FILE"; then + # Section exists: check if driver entry exists + if ! grep -q "^${DRIVER_NAME}=" "$USER_ODBCINST_FILE"; then + # Driver entry does not exist, add under [ODBC Drivers] + sed -i '' "/^\[ODBC Drivers\]/a\\ +${DRIVER_NAME}=Installed +" "$USER_ODBCINST_FILE" + fi +else + # Section doesn't exist, append both section and driver entry at end + { + echo "" + echo "[ODBC Drivers]" + echo "${DRIVER_NAME}=Installed" + } >> "$USER_ODBCINST_FILE" +fi From f7376135e7a0ebe41ec10199483197701aca5384 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 27 Nov 2025 10:47:22 -0800 Subject: [PATCH 5/5] Fix Lint issues --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 3 ++- .../flight/sql/odbc/odbc_impl/ui/dsn_configuration_window.cc | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 0d50ee31e36..338ee165187 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -140,7 +140,8 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER) set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-flight-sql-odbc-patch.xml") - set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp") + set(CPACK_WIX_UI_BANNER + "${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp") endif() get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/dsn_configuration_window.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/dsn_configuration_window.cc index 252475c0e44..be6b3fe4799 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/dsn_configuration_window.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/ui/dsn_configuration_window.cc @@ -29,7 +29,6 @@ #include #include #include -#include "arrow/flight/sql/odbc/odbc_impl/util.h" #define COMMON_TAB 0 #define ADVANCED_TAB 1