dev-os

[Linux] FreeTDS 사용

검은바람 2013. 7. 15. 10:09
반응형

FreeTDS란?

FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to SQL Server and Sybase databases.

 

다운로드 주소

ftp://ftp.astron.com/pub/freetds/stable/freetds-stable.tgz

 

freetds.conf 설정

[global]

tds version = 8.0 # Option 아래 설정만으로 커넥션이 안될경우 이 줄도 추가해보자.

[MyServer]

host = My Server IP

port = 1433

tds version = 8.0

 

Python Sample(SQL Server)

import pymssql

conn = pymssql.connect(host="MyServer", user="", password="", database="")

cur = conn.cursor()

qry = "SELECT * FROM test"

rows = cur.fetchall()

cur.close()

conn.close()

print str(rows)

 

반응형