-
Notifications
You must be signed in to change notification settings - Fork 56
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.8, 8.10, 9.2, 9.4) have
3.1.12
- SLES 15 SP5 has
3.0.2-3.23
- SLES 15 SP6 has
3.0.2-150600.17.2
- Ubuntu (22.04, 24.04, 24.10) have
3.1.15-3
The instructions provided below specify the steps to build MariaDB Connector/ODBC version 3.2.4 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4)
- SLES (15 SP5, 15 SP6)
- Ubuntu (20.04, 22.04, 24.04, 24.10)
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.
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.4/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.
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>/
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/MariaDB-Connector-ODBC/3.2.4/patch/"
-
RHEL (8.8, 8.10, 9.2, 9.4)
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 SP5, 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 (20.04, 22.04, 24.04, 24.10)
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
- Download unixODBC source code
cd $SOURCE_ROOT git clone -b v2.3.9 https://github.com/lurcher/unixODBC.git cd unixODBC curl -sSL $PATCH_URL/iconv.diff | git apply --ignore-whitespace - autoreconf -fi ./configure make sudo make install
-
Download MariaDB Connector/ODBC source code
cd $SOURCE_ROOT git clone -b 3.2.4 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
-
-
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 20.04
sudo mysql -u root -e "USE mysql; UPDATE user SET plugin='mysql_native_password' WHERE User='root'; FLUSH PRIVILEGES;" sudo env PATH=$PATH mysql -u root -e "CREATE DATABASE IF NOT EXISTS test;"
- Ubuntu (22.04, 24.04, 24.10)
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 20.04
-
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.
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.