SAP HANA 直接连接 SQL Server 数据库(Linux系统)


1、安装ODBC

https://docs.microsoft.com/zh-tw/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#suse17

注意一下,先安装   msodbcsql17  再安装  msodbcsql

我的是SUSE  12

 

sudo su
curl -O https://packages.microsoft.com/keys/microsoft.asc
rpm --import microsoft.asc

#Download appropriate package for the OS version
#Choose only ONE of the following, corresponding to your OS version

#SUSE Linux Enterprise Server 11 SP4
#Ensure SUSE Linux Enterprise 11 Security Module has been installed
#zypper ar https://packages.microsoft.com/config/sles/11/prod.repo

#SUSE Linux Enterprise Server 12
zypper ar https://packages.microsoft.com/config/sles/12/prod.repo

#SUSE Linux Enterprise Server 15
#zypper ar https://packages.microsoft.com/config/sles/15/prod.repo
#(Only for driver 17.3 and below)
SUSEConnect -p sle-module-legacy/15/x86_64

exit
sudo ACCEPT_EULA=Y zypper install -y msodbcsql17
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y zypper install -y mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo zypper install -y unixODBC-devel


ln -s /usr/lib64/libodbc.so.2.0.0 /usr/lib64/libodbc.so.1
ln -s /usr/lib64/libodbcinst.so.2.0.0 /usr/lib64/libodbcinst.so.1


sudo ACCEPT_EULA=Y apt-get install msodbcsql

如果执行
zypper ref  https://packages.microsoft.com/config/sles/12/prod.repo
出现
Repository named 'packages-microsoft-com-prod' already exists. Please use another alias.
可以先删除,
zypper rr  packages-microsoft-com-prod

如果包冲突,可以先删除

sudo zypper rm unixODBC-utf16-devel
sudo zypper rm unixODBC-utf16

找了一圈,主要是通过下面的网页, 创建成功的

https://launchpad.support.sap.com/#/notes/1644499

https://www.cnblogs.com/StephenAmell/p/13473524.html