为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:8.1.3.140 、8.1.3.62
【操作系统】:kylin10 SP3
【CPU】:x86
上网下载了freetds-1.4.22,unixodbc-2.3.12的源码,编译安装的。
分别编译:
./configure --libdir=/usr/lib64
freedts.conf
[MSSQLSERVER]
host=192.168.110.5
port=1433
tds version = 8.0
odbc.ini
[mssql-1]
Driver = FreeTDS
Description = MSSOLSERVER DSN 1
Trace = No
Servername = MSSQLSERVER
Database =test_1
[mssql-2]
Driver = FreeTDS
Description = MSSOLSERVER DSN 2
Trace = No
Server = 192.168.110.5
Database = test_1
Port = 1433
TDS_Version = 8.0
odbcinst.ini
[FreeTDS]
Description = Free Sybase & MS SQL Driver
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsS.so
Driver64 = /usr/lib64/libtdsodbc.so
Setup64 = /usr/lib64/libtdsS.so
Port = 1433
tsql跟isql也能联通了,能查数据了
[root@new etc]# isql -v mssql-1 sa 7TbixKM$ +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | echo [string] | | quit | | | +---------------------------------------+ [root@new etc]# tsql -S MSSQLSERVER -U sa -P 7TbixKM$ -D test_1 locale is "zh_CN.UTF-8" locale charset is "UTF-8" using default charset "UTF-8" Setting test_1 as default database in login packet
想要连接mssql,dblink创建成功后,查表时候报错误[-6033]:DBLINK连接丢失。
Create or replace link ms_link1 connect 'ODBC' with "sa" identified by "7TbixKM$" using 'mssql-1';
Create or replace link ms_link2 connect 'ODBC' with "sa" identified by "7TbixKM$" using 'mssql-2';
SQL> select * from t@ms_link1;
select * from t@ms_link1;
第1 行附近出现错误[-6033]:DBLINK连接丢失.
查看日志:
[ERROR] database P0000019189 T0000000000000019285 ODBC error:[01000][0][unixODBC][Driver Manager]Can't open lib '/usr/lib64/libtdsodbc.so' : file not found
[ERROR] database P0000019189 T0000000000000019285 ODBC connect error:[08003][0][unixODBC][Driver Manager]Connection not open
[ERROR] database P0000019189 T0000000000000019285 ODBC SQLDISCONNECT FAILURE
但是这个so文件,明明存在,权限是777
# ldd /usr/lib64/libtdsodbc.so
linux-vdso.so.1 (0x00007ffe00ec5000)
libodbc.so.2 => /lib64/libodbc.so.2 (0x00007faa6f60f000)
libodbcinst.so.2 => /lib64/libodbcinst.so.2 (0x00007faa6f5f2000)
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007faa6f5ed000)
libssl.so.1.1 => /usr/lib64/libssl.so.1.1 (0x00007faa6f559000)
libcrypto.so.1.1 => /usr/lib64/libcrypto.so.1.1 (0x00007faa6f26f000)
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007faa6f24e000)
libc.so.6 => /usr/lib64/libc.so.6 (0x00007faa6f094000)
/lib64/ld-linux-x86-64.so.2 (0x00007faa6f70e000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00007faa6f07a000)
死活连不了,LD_LIBRARY_PATH环境变量我也设置了。
如果使用yum install freetds,麒麟安装的freetds版本是1.0的,这个版本,使用dblink,可以查数据。但是存在bug,源库库名要带下划线,比如test_1,才能正常查询。如果库名不带下划线,比如test,就会报找不到存储过程test。
这个是啥问题,怎么解决。
解决了吗?求解决方法