-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The instructions provided below specify the steps to build MariaDB Connector/ODBC version 3.0.3 on Linux on IBM Z for following distributions:
- RHEL (7.3, 7.4)
- SLES (12 SP2, 12 SP3)
- Ubuntu (16.04, 17.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 writeable directory anywhere you'd like to place it.
-
RHEL (7.3, 7.4)
sudo yum install -y mariadb mariadb-server git cmake gcc openssl-devel openssl wget tar
-
SLES (12 SP2, 12 SP3)
sudo zypper install -y mariadb unixODBC unixODBC-devel git cmake gcc libopenssl-devel openssl glibc-locale
-
Ubuntu (16.04)
sudo apt-get update sudo apt-get install -y mariadb-server git cmake gcc libssl-dev wget tar
-
Ubuntu (17.10)
sudo apt-get update sudo apt-get install -y mariadb-server unixodbc unixodbc-dev git cmake gcc libssl-dev
cd /<source_root>/
wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.4.tar.gz
tar xvf unixODBC-2.3.4.tar.gz
cd unixODBC-2.3.4
./configure
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
- Get source
cd /<source_root>/ git clone https://github.com/MariaDB/mariadb-connector-c.git cd mariadb-connector-c git checkout tags/v3.0.3
- Build and install
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release make sudo make install
- 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
- Update root plugin and create test database (Ubuntu)
sudo mysql -u root -e "USE mysql; UPDATE user SET plugin='mysql_native_password' WHERE User='root'; FLUSH PRIVILEGES;" mysql -u root -e "CREATE DATABASE test;"
cd unittest/libmariadb
ctest
Note: ps_bugs
test is expected to fail for RHEL and Ubuntu 16.04. misc
test is expected to fail for all distros. These failures are not specific to IBM Z and can be ignored.
Note: If connection
test fails, drop anonymous user using mysql -u root -e "DROP USER ''@'localhost';"
and run the test again.
-
Download MariaDB Connector/ODBC source code
cd /<source_root>/ git clone https://github.com/MariaDB/mariadb-connector-odbc.git cd mariadb-connector-odbc git checkout tags/3.0.3
-
Make changes to
/<source_root>/mariadb-connector-odbc/ma_connection.c
.@@ -556,7 +556,7 @@ MADB_Dsn *Dsn) { char StmtStr[128]; - unsigned ReportDataTruncation= 1; + my_bool ReportDataTruncation= 1; unsigned int i; unsigned long client_flags= 0L; my_bool my_reconnect= 1;
-
Make changes to
/<source_root>/mariadb-connector-odbc/test/basic.c
.@@ -71,7 +71,7 @@ { SQLRETURN rc= SQL_SUCCESS; - SQLINTEGER value=3; + SQLSMALLINT value=3; SQLWCHAR Buffer[20]; char buffer[128];
-
Make changes to
/<source_root>/mariadb-connector-odbc/test/param.c
.@@ -1485,6 +1485,7 @@ ODBC_TEST(odbc45) { SQLSMALLINT i; + SQLCHAR value; SQLLEN len= 0; SQLCHAR val[][4]= {"0", "1"};//, "4", "-1", "0.5", "z"}, SQLWCHAR valw[][4]= { { '0', '\0' }, { '1', '\0' }, { '4', '\0' }, { '-', '1', '\0' }, { '0', '.', '5', '\0' }, { 'z', '\0' } }; @@ -1523,7 +1524,8 @@ for (i= 0; i<sizeof(XpctdValue); ++i) { CHECK_STMT_RC(Stmt, SQLFetch(Stmt)); - is_num(my_fetch_int(Stmt, 1), XpctdValue[i]); + SQLGetData(Stmt, 1, SQL_C_BIT, &value, sizeof(value), 0); + is_num(value, XpctdValue[i]); } CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
-
Build and install
- For RHEL & SLES
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DWITH_OPENSSL=true -DCMAKE_INSTALL_PREFIX=/usr/local make sudo make install
- For Ubuntu
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DWITH_OPENSSL=true -DCMAKE_INSTALL_PREFIX=/usr/local -DODBC_LIB_DIR=/usr/lib/s390x-linux-gnu/ make sudo make install
Note: MariaDB server needs to be started and configured as specified in step 4.1, if it was skipped earlier.
-
Create root user for any host (Ubuntu 17.10 only)
mysql -u root -e "CREATE USER 'root' IDENTIFIED BY 'rootpass';"
-
Set password for root@localhost
mysql -u root -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('rootpass');"
-
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=rootpass
-
Edit odbc.ini file and append the following text
Note: Edit
/etc/unixODBC/odbc.ini
on SLES,/etc/odbc.ini
on Ubuntu 17.10 and/usr/local/etc/odbc.ini
on Ubuntu 16.04 & RHEL[maodbc_test] Driver = maodbc_test DESCRIPTION = MariaDB ODBC Connector Test SERVER = localhost PORT = 3306 DATABASE = test UID = root PASSWORD = rootpass
-
Edit odbcinst.ini file and append the following text (RHEL and SLES)
Note: Edit
/usr/local/etc/odbcinst.ini
on RHEL and/etc/unixODBC/odbcinst.ini
on SLES.[ODBC] # Change to "yes" to turn on tracing Trace = no TraceFile = /tmp/maodbc_trace.log [maodbc_test] Driver = /usr/local/lib64/libmaodbc.so DESCRIPTION = MariaDB ODBC Connector Threading = 0 IconvEncoding=UTF16
-
Edit odbcinst.ini file and append the following text (Ubuntu)
Note: Edit
/usr/local/etc/odbcinst.ini
on Ubuntu 16.04 and/etc/odbcinst.ini
on Ubuntu 17.10.[ODBC] # Change to "yes" to turn on tracing Trace = no TraceFile = /tmp/maodbc_trace.log [maodbc_test] Driver = /usr/local/lib/libmaodbc.so DESCRIPTION = MariaDB ODBC Connector Threading = 0 IconvEncoding=UTF16
-
Run tests
cd /<source_root>/mariadb-connector-odbc/test ctest