LINUX ODBC ( MS-SQL 연결)
1. 먼저 아래 URL 페이지에서 해당 버전에 맞는 파일을 다운로드 진행한다
http://www.microsoft.com/en-us/download/details.aspx?id=28160.
아니면 아래에서 바로 다운로드
sqlncli-11.0.1790.0.tar
2. 파일 받은것을 압축 진행 후 설치 조건이 맞는지 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@se ~]# tar xvfz sqlncli-11.0.1790.0.tar.gz [root@se ~]# cd sqlncli-11.0.1790.0 [root@se sqlncli-11.0.1790.0]# ./install.sh verify Microsoft SQL Server ODBC Driver V1.0 for Linux Installation Script Copyright Microsoft Corp. Starting install for Microsoft SQL Server ODBC Driver V1.0 for Linux Checking for 64 bit Linux compatible OS ..................................... OK Checking required libs are installed ........................................ OK unixODBC utilities (odbc_config and odbcinst) installed ..................... OK unixODBC Driver Manager version 2.3.0 installed ......................... FAILED unixODBC Driver Manager configuration correct ...................... NOT CHECKED Microsoft SQL Server ODBC Driver V1.0 for Linux already installed .. NOT CHECKED See /tmp/sqlncli.6012.27237.19632/install.log for more information about installation failures. |
2. 크게 문제 되지 않으면 이제 빌드 작업을 진행하여 설치를 진행한다 마지막 문구대로 /tmp 폴더로 이동 후 make install 진행
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
[root@ sqlncli-11.0.1790.0]# ./build_dm.sh Build unixODBC 2.3.0 DriverManager script Copyright Microsoft Corp. In order to use the Microsoft SQL Server ODBC Driver V1.0 for Linux, the unixODBC DriverManager must be installed on your computer. unixODBC DriverManager is a third-party tool made available by the unixODBC Project. To assist you in the installation process, this script will attempt to download, properly configure, and build the unixODBC DriverManager from http://www.unixodbc.org/ for use with Microsoft SQL Server ODBC Driver V1.0 for Linux. Alternatively, you can choose to download and configure unixODBC DriverManager from http://www.unixodbc.org/ yourself. Note: unixODBC DriverManager is licensed to you under the terms of an agreement between you and the unixODBC Project, not Microsoft. Microsoft does not guarantee the unixODBC DriverManager or grant any rights to you. Prior to downloading, you should review the license for unixODBC DriverManager at http://www.unixodbc.org/. The script is provided as a convenience to you as-is, without any express or implied warranties of any kind. Microsoft is not liable for any issues arising out of your use of the script. Enter 'YES' to have this script continue: YES Verifying processor and operating system ................................... OK Verifying wget is installed ................................................ OK Verifying tar is installed ................................................. OK Verifying make is installed ................................................ OK Downloading unixODBC 2.3.0 DriverManager ................................... OK Unpacking unixODBC 2.3.0 DriverManager ..................................... OK Configuring unixODBC 2.3.0 DriverManager ................................... OK Building unixODBC 2.3.0 DriverManager ...................................... OK Build of the unixODBC 2.3.0 DriverManager complete. Run the command 'cd /tmp/unixODBC.24068.30191.14043/unixODBC-2.3.0; make install' to install the driver manager. PLEASE NOTE THAT THIS WILL POTENTIALLY INSTALL THE NEW DRIVER MANAGER OVER ANY EXISTING UNIXODBC DRIVER MANAGER. IF YOU HAVE ANOTHER COPY OF UNIXODBC INSTALLED, THIS MAY POTENTIALLY OVERWRITE THAT COPY. [root@ sqlncli-11.0.1790.0]# cd /tmp/unixODBC.24068.30191.14043/unixODBC-2.3.0; make install |
3. 다시 설치폴더로 이동 후 install.sh install 진행
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@se unixODBC-2.3.0]# cd - /root/sqlncli-11.0.1790.0 [root@se sqlncli-11.0.1790.0]# ./install.sh install Enter YES to accept the license or anything else to terminate the installation: YES Checking for 64 bit Linux compatible OS ..................................... OK Checking required libs are installed ........................................ OK unixODBC utilities (odbc_config and odbcinst) installed ..................... OK unixODBC Driver Manager version 2.3.0 installed ............................. OK unixODBC Driver Manager configuration correct .............................. OK* Microsoft SQL Server ODBC Driver V1.0 for Linux already installed .... NOT FOUND Microsoft SQL Server ODBC Driver V1.0 for Linux files copied ................ OK Symbolic links for bcp and sqlcmd created ................................... OK Microsoft SQL Server ODBC Driver V1.0 for Linux registered ........... INSTALLED Install log created at /tmp/sqlncli.26044.7953.8108/install.log. One or more steps may have an *. See README for more information regarding these steps. |
4. 이제 정상적으로 설치가 완료되었으니 SQL 접속을 시도해 보자 / sql 접속 후 zipcod 테이블을 확인
-Q : 쿼리문
-S : SQL 서버 아이피 또는 도메인
-U : 사용자
-P : 패스워드
1 2 3 4 5 6 7 8 9 10 |
[root@se sqlncli-11.0.1790.0]# sqlcmd -Q "select top 5 * from T_ZIPCODE;" -S sql.xinet.kr -U xinet -P xinet_password Uid ZipCode Sido Gugun Dong Bunji ----------- ---------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 1 135-806 서울 강남구 개포1동 경남아파트 NULL 2 135-807 서울 강남구 개포1동 우성3차아파트 (1∼6동) 3 135-806 서울 강남구 개포1동 우성9차아파트 (901∼902동) 4 135-770 서울 강남구 개포1동 주공아파트 (1∼16동) 5 135-805 서울 강남구 개포1동 주공아파트 (17∼40동) (5 rows affected) |