分类: BSD
2008-11-04 09:54:07
环境
1 2005 Enterprise Edition on Windows 2003 R3 I386
2 7.0 Beta4
安装MSSQL 2005
略(参考MS XX文档)
安装
#cd /usr/ports/lang/python25
#make
#make install
安装FreeTDS 0.64_1
#cd /usr/ports/datebases/freetds-msdblib
#make
#make install
配置freetds.conf
[root@bsdx64]#cat /usr/local/etc/freetds.conf
dump file = /tmp/freetds.log
[MyServer2k]
host = 192.168.0.75
port = 1433
tds version = 8.0
Database = testdb
安装py-mssql
#cd /usr/ports/databases/py-mssql
#make
#make install
测试
编辑py_mssql_test.py
import _mssql
on = _mssql.connect("MyServer2k","yarshure","123456")
con.select_db("AdventureWorks")
con.query("select top 5 * from [Person].[Address]")
row=con.fetch_array()
print row