Skip to content

Instantly share code, notes, and snippets.

@raspberry9
Created October 24, 2015 08:00
Show Gist options
  • Save raspberry9/0e95f85f7e423d11c554 to your computer and use it in GitHub Desktop.
Save raspberry9/0e95f85f7e423d11c554 to your computer and use it in GitHub Desktop.
MSSQL + unixODBC + freeTDS 설정하기
1. MSSQL 서버 설치 - 알아서
2. MSSQL 서버 외부 접속 설정
- Sql Server Configuration Manager > SQL Server 네트워크 구성 > [...]에 대한 프로토콜 > 명명된 파이프(사용), TCP/IP(사용)
TCP/IP우클릭>속성>IPAll에 포트 넣기(1433)
- 고급 보안이 포함된 Windows 방화벽>인바운드 규칙>1433 TCP 포트 개방
3. unixODBC, freeTDS 설치
- yum install freeTDS(unixODBC도 알아서 설치됨)
- /etc/freetds.conf
-----------------------------------------------
[global]
;tds version = 4.2
;dump file = /tmp/freetds.log
;debug flags = 0xffff
timeout = 10
connect timeout = 10
text size = 64512
[NAME] ==> 여기에 적은 이름이 odbc.ini의 Servername과 동일해야 한다.
host = [MSSQL 깔린서버 주소]
port = [포트]
tds version = 7.4 ==> MSSQL 2014인 경우
client charset = UTF-8
-----------------------------------------------
- /etc/odbcinst.ini
-----------------------------------------------
[FreeTDS]
Description = ODBC for MSSQL
Driver = /usr/lib64/libtdsodbc.so.0
Setup = /usr/lib64/libtdsS.so.2
FileUsage = 1
client charset = utf-8
-----------------------------------------------
- /etc/odbc.ini
-----------------------------------------------
[NAME]
Driver = FreeTDS
Servername = NAME ==> freetds.conf와 동일한걸로
Port = [포트]
Database = [데이터베이스명]
-----------------------------------------------
- 테스트
tsql -S NAME -U dbuser -P dbpassword
isql -v NAME dbuser dbpassword
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment