1. apt-add-repository 가 없는 경우 설치
sudo apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates
2. apt repository 등록 ( source list )
출처 : Linux Software Repository for Microsoft Products | Microsoft Docs
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod
sudo apt-get update
3. Microsoft ODBC Driver for SQL Server 설치
출처 : Microsoft ODBC Driver for SQL Server 설치(Linux) - ODBC Driver for SQL Server | Microsoft Docs
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
4. 파일 경로 /etc/odbc.ini
cat /etc/odbcinst.ini
명령으로 Driver 버전 확인하여 아래 파일 편집시 사용
[mssql] # dns 명칭
Driver = ODBC Driver 18 for SQL Server
Server = DB IP (x.x.x.x)
Port = 1433
Database= DBname
5. odbc.ini 파일 수정 후 다시로드
odbcinst -q -d
6. 테스트
# unixODBC에서 제공하는 isql 명령어 사용 isql dns
isql mssql
# 비밀번호에 특수 문자가 있는 경우 ' 로 묶어서 사용
isql mssql username passwords -v
7. 추가사항
6번 테스트 시 아래와 같은 오류가 발생하는 경우
[08001][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:self signed certificate]
4번에 TrustServerCertificate=yes 추가
[mssql] # dns 명칭
Driver = ODBC Driver 18 for SQL Server
Server = DB IP (x.x.x.x)
Port = 1433
Database= DBname
TrustServerCertificate=yes
'Server > Linux' 카테고리의 다른 글
FreeTDS 로 MSSQL 2008 (구버전 SQL) 연결시 Error 0002 (severity 9): Adaptive Server connection failed (1) | 2024.11.08 |
---|---|
docker 완전 삭제 (0) | 2022.09.23 |
[ubuntu] 파일 삭제 후 복구 (0) | 2022.09.20 |
ZABBIX Server 및 Agent 설치 - ubuntu 20.04 , docker (0) | 2022.03.23 |
AttributeError: module 'lib' has no attribute 'X509_get_notAfter' (0) | 2022.02.23 |