Building MariaDB Connector ODBC - linux-on-ibm-z/docs GitHub Wiki
Building MariaDB Connector/ODBC
Below versions of MariaDB Connector/ODBC are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.10, 9.4, 9.5) have
3.1.12
- SLES 15 SP6 has
3.0.2-150600.17.2
- Ubuntu (22.04, 24.04, 24.10, 25.04) have
3.1.15-3
The instructions provided below specify the steps to build MariaDB Connector/ODBC version 3.2.6 on Linux on IBM Z for following distributions:
- RHEL (8.10, 9.4, 9.5)
- SLES 15 SP6
- Ubuntu (22.04, 24.04, 24.10, 25.04)
General Notes:
-
When following the steps below, please use a standard permission user unless otherwise specified.
-
A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
Build and Install MariaDB Connector/ODBC
1. Build using script
If you want to build MariaDB Connector/ODBC using manual steps, go to Step 2.
Use the following commands to build MariaDB Connector ODBC using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/MariaDB-Connector-ODBC/3.2.6/build_mariadb_connector_odbc.sh
# Build MariaDB Connector/ODBC
bash build_mariadb_connector_odbc.sh [Provide -t option for executing build with tests]
In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
2. Install dependencies
Note: MariaDB ODBC connector requires minimum MariaDB version 10.2.7. At the time of creation of these build instructions, MariaDB Connector/ODBC was verified with MariaDB 10.11.8
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.10, 9.4, 9.5)
sudo yum groupinstall -y 'Development Tools' sudo yum install -y mariadb mariadb-server mysql-devel git cmake gcc gcc-c++ libarchive openssl-devel openssl tar curl libcurl-devel krb5-devel make glibc-langpack-en autoconf automake libtool libtool-ltdl-devel libiodbc-devel
-
SLES 15 SP6
sudo rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB sudo zypper addrepo --gpgcheck --refresh https://archive.mariadb.org/mariadb-10.11.8/yum/sles15-s390x/ mariadb sudo zypper --gpg-auto-import-keys refresh sudo zypper install -y git cmake MariaDB-server gcc gcc-c++ libopenssl-devel openssl glibc-locale tar curl libcurl-devel krb5-devel autoconf automake libtool awk
-
Ubuntu (22.04, 24.04, 24.10, 25.04)
sudo apt-get update sudo apt-get install -y mariadb-server unixodbc-dev odbcinst git cmake gcc g++ libssl-dev tar curl libcurl4-openssl-dev libkrb5-dev
3. Build and install unixODBC (RHEL and SLES)
- Download unixODBC source code
cd $SOURCE_ROOT git clone -b 2.3.12 https://github.com/lurcher/unixODBC.git cd unixODBC autoreconf -fi ./configure make sudo make install
4. Build and install MariaDB Connector/ODBC
-
Download MariaDB Connector/ODBC source code
cd $SOURCE_ROOT git clone -b 3.2.6 https://github.com/MariaDB/mariadb-connector-odbc.git cd mariadb-connector-odbc git submodule init git submodule update
-
For RHEL and SLES
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DWITH_SSL=OPENSSL -DCMAKE_INSTALL_PREFIX=/usr/local -DODBC_LIB_DIR=/usr/local/lib make sudo make install sudo cp /usr/local/lib/mariadb/libmaodbc.so /usr/local/lib
-
For Ubuntu
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DWITH_SSL=OPENSSL -DCMAKE_INSTALL_PREFIX=/usr/local -DODBC_LIB_DIR=/usr/lib/s390x-linux-gnu/ make sudo make install sudo cp /usr/local/lib/mariadb/libmaodbc.so /usr/local/lib
-
5. Testing (Optional)
5.1. Start MariaDB server and configure for testing
-
Start MariaDB server
sudo mysql_install_db --user=mysql sudo mysqld_safe --user=mysql &
-
Create the following softlink
- RHEL
sudo ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
- SLES
sudo ln -s /run/mysql/mysql.sock /tmp/mysql.sock
- Ubuntu
sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
- RHEL
-
Update root plugin and create test database (Ubuntu Only)
- Ubuntu (22.04, 24.04, 24.10, 25.04)
sudo env PATH=$PATH mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('');" sudo env PATH=$PATH mysql -u root -e 'CREATE DATABASE IF NOT EXISTS test;'
- Ubuntu (22.04, 24.04, 24.10, 25.04)
5.2. Run Connector/ODBC test cases
-
Set password for root@localhost
sudo env PATH=$PATH mysql -u root -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');"
-
Set the environment variables
export TEST_DRIVER=maodbc_test export TEST_SCHEMA=test export TEST_DSN=maodbc_test export TEST_UID=root export TEST_PASSWORD=
-
Run tests
cd $SOURCE_ROOT/mariadb-connector-odbc/test
- Set the environment variables
export ODBCINI="$PWD/odbc.ini" export ODBCSYSINI=$PWD
- Run command for test cases
ctest
- Set the environment variables
-
All the test cases should pass.