iSQL - mysql 服务器的分段错误但在 SQL 服务器上工作正常
iSQL - Segmentation fault for mysql server but works fine with SQL servers
我可以使用 iSQL 连接到 SQL 服务器,但是当我测试 mysql 服务器时,它会抛出分段错误。 tsql 也有同样的问题。 Mysql服务器版本是5.7。测试了 2 个不同的 MySQL 服务器(虽然是 5.7)。
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
猫/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 用户名密码
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, "[=15=][=15=][=15=][=15=][=15=][=15=]CLIENT_SERVER001[=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=]"..., 512, MSG_NOSIGNAL|MSG_MORE, NULL, 0) = 512
poll([{fd=4, events=POLLOUT}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "[=15=]L[=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=]\n[=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=]utf"..., 76, MSG_NOSIGNAL, NULL, 0) = 76
poll([{fd=4, events=POLLIN}], 1, -1) = 1 ([{fd=4, revents=POLLIN}])
recvfrom(4, "[[=15=][=15=][=15=]\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)
想通了。
必须下载 ODBC lib 5.2.7 然后将其复制到 libs 目录并在 odbcinst.ini 和 odbc.ini 中创建一个新条目(或将行驱动程序添加到 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
提取并复制 mysql-connector-odbc-5.2.7-linux-debian6.0-x86-64bit/lib/libmyodbc5*.so
到 /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
我可以使用 iSQL 连接到 SQL 服务器,但是当我测试 mysql 服务器时,它会抛出分段错误。 tsql 也有同样的问题。 Mysql服务器版本是5.7。测试了 2 个不同的 MySQL 服务器(虽然是 5.7)。
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
猫/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 用户名密码
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, "[=15=][=15=][=15=][=15=][=15=][=15=]CLIENT_SERVER001[=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=]"..., 512, MSG_NOSIGNAL|MSG_MORE, NULL, 0) = 512
poll([{fd=4, events=POLLOUT}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "[=15=]L[=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=]\n[=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=][=15=]utf"..., 76, MSG_NOSIGNAL, NULL, 0) = 76
poll([{fd=4, events=POLLIN}], 1, -1) = 1 ([{fd=4, revents=POLLIN}])
recvfrom(4, "[[=15=][=15=][=15=]\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)
想通了。
必须下载 ODBC lib 5.2.7 然后将其复制到 libs 目录并在 odbcinst.ini 和 odbc.ini 中创建一个新条目(或将行驱动程序添加到 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
提取并复制 mysql-connector-odbc-5.2.7-linux-debian6.0-x86-64bit/lib/libmyodbc5*.so
到 /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