mysqlsegmentation-faultisql

iSQL - Segmentation fault for mysql server but works fine with SQL servers


I can connect to SQL servers using iSQL but when I tested mysql server it throws Segmentation fault error. Same issue with tsql. Mysql Server version is 5.7. Tested with 2 different MySQL server (5.7 though).

root@client001~: isql -v DB01
Segmentation fault (core dumped)

cat /etc/odbc.ini

[DB01]
Driver = FreeTDS
Server = 10.10.10.10
Port = 3306
TDS Version = 7.2

cat /etc/odbcinst.ini

[FreeTDS]
Description=v0.63 with protocol v8.0
Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so

strace isql -v DB01 username password

lines_above_this are just reading odbc.ini
brk(0xa68000)                           = 0xa68000
read(4, "", 4096)                       = 0
close(4)                                = 0
brk(0xa65000)                           = 0xa65000
brk(0xa48000)                           = 0xa48000
brk(0xa47000)                           = 0xa47000
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
ioctl(4, FIONBIO, [1])                  = 0
connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("10.10.10.10")}, 16) = -1 EINPROGRESS (Operation now in progress)
poll([{fd=4, events=POLLOUT}], 1, 90000000) = 1 ([{fd=4, revents=POLLOUT}])
getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
poll([{fd=4, events=POLLOUT}], 1, -1)   = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "\2\0\2\0\0\0\0\0CLIENT_SERVER001\0\0\0\0\0\0\0\0\0\0"..., 512, MSG_NOSIGNAL|MSG_MORE, NULL, 0) = 512
poll([{fd=4, events=POLLOUT}], 1, -1)   = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "\2\1\0L\0\0\0\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0utf"..., 76, MSG_NOSIGNAL, NULL, 0) = 76
poll([{fd=4, events=POLLIN}], 1, -1)    = 1 ([{fd=4, revents=POLLIN}])
recvfrom(4, "[\0\0\0\n5.7", 8, MSG_NOSIGNAL, NULL, NULL) = 8
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

Solution

  • Figured it out.

    Had to download ODBC lib 5.2.7 then copy it to libs dir and create a new entry in odbcinst.ini and odbc.ini (or add line Driver to odbc.ini) .

    wget https://cdn.mysql.com/archives/mysql-connector-odbc-5.2/mysql-connector-odbc-5.2.7-linux-debian6.0-x86-64bit.tar.gz
    

    Extract and copy mysql-connector-odbc-5.2.7-linux-debian6.0-x86-64bit/lib/libmyodbc5*.so to /usr/lib/x86_64-linux-gnu/odbc/

    cat /etc/odbcinst.ini

    [FreeTDS]
    Description=v0.63 with protocol v8.0
    Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
    Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
    
    [MySQL_ODBC]
    Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5w.so
    

    cat /etc/odbc.ini

    [DB01]
    Driver = MySQL_ODBC
    Server = 10.10.10.10
    Port = 3306
    TDS Version = 7.2