'odbc'에 해당되는 글 1건

  1. 2014.05.21 unixODBC SQL Server Native Client 11.0 설치 (MSSQL)
DB/NoSQL/Mssql2014. 5. 21. 18:53

 

MS사이트 : http://www.microsoft.com/en-us/download/details.aspx?id=28160


1) 파일다운로드 ( centos6 64bit의 경우 Linux6을 선택 다운로드 안될때 MS사이트 URL확인 )

$ wget http://download.microsoft.com/download/6/A/B/6AB27E13-46AE-4CE9-AFFD-406367CADC1D/Linux6/sqlncli-11.0.1790.0.tar.gz

 

2) 압축풀고 build_dm실행

$ tar xvfz sqlncli-11.0.1790.0.tar.gz
$ cd sqlncli-11.0.1790.0

$ ./build_dm.sh //실행후 나오는 디렉토리 기준으로 make 실행
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.32631.28583.22057/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.

 

3) 위에 tmp 경로에서 make install 실행

$ cd /tmp/unixODBC.32631.28583.22057/unixODBC-2.3.0
$ make install

touch /etc/odbcinst.ini
touch /etc/odbc.ini
mkdir -p /etc/ODBCDataSources
/usr/bin/odbc_config --header > /usr/include/unixodbc_conf.h
make[2]: Leaving directory `/tmp/unixODBC.32631.28583.22057/unixODBC-2.3.0'
make[1]: Leaving directory `/tmp/unixODBC.32631.28583.22057/unixODBC-2.3.0'

 

4) install 실행
$ cd /root/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 ............................. OK
unixODBC Driver Manager configuration correct .............................. OK*
Microsoft SQL Server ODBC Driver V1.0 for Linux already installed .... NOT FOUND
Install log created at /tmp/sqlncli.18759.30552.14202/install.log.
One or more steps may have an *. See README for more information regarding
these steps.

$ ./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.27629.13209.11572/install.log.
One or more steps may have an *. See README for more information regarding
these steps.

$ vi /etc/odbcinst.ini //odbc추가확인
[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading=1
UsageCount=1

 

5) 최종 설치 결과확인

$ ./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 ............................. OK
unixODBC Driver Manager configuration correct .............................. OK*
Microsoft SQL Server ODBC Driver V1.0 for Linux already installed .... INSTALLED

 

6) isql 이용한 접속테스트

$ vi /etc/odbc.ini

-------------------------

[MSSQLTEST]
driver=SQL Server Native Client 11.0
server=192.168.0.0
port=1433
database=DBNAME

-------------------------

$ isql -v MSSQLTEST userid userpassword

+---------------------------------------+
| Connected!                           
|                                       
| sql-statement                         
| help [tablename]                      
| quit                                  
|                                       
+---------------------------------------+

 

※ PHP에는 PDO ODBC에는 odbcinst.ini에 등록된 이름으로 odbc.ini처럼 지정해주면됨
 => odbc:DRIVER=SQL Server Native Client 11.0;Server=192.168.0.0;
port=1433;database=dbname;

 

※ C컴파일에러시 gcc설치할것!!
view /tmp/unixODBC.19411.11370.8462/build_dm.log
yum install gcc


※ ODBC 정보확인은 아래와 같이

$ odbcinst -j

unixODBC 2.2.14

DRIVERS............: /etc/odbcinst.ini

SYSTEM DATA SOURCES: /etc/odbc.ini

FILE DATA SOURCES..: /etc/ODBCDataSources

USER DATA SOURCES..: /root/.odbc.ini

SQLULEN Size.......: 8

SQLLEN Size........: 8

SQLSETPOSIROW Size.: 8

 

Posted by 시니^^