在Ubuntu中使用pyodbc 连接 MS SQl servers

安装依赖包

Edit the file /etc/freetds/freetds.conf and replace placeholders appropriately. Note that we are calling our server sqlserver.

Edit /etc/odbcinst.ini like this:

Edit /etc/odbc.ini like this, to add a data source named sqlserverdatasource:

If everything is fine, with the help of pyodbcit should be really easy! You may try the following snippet:

解决中文字符乱码 问号的问题:

添加一个配置参数unicode_results=True

参考:

http://www.tryolabs.com/Blog/2012/06/25/connecting-sql-server-database-python-under-ubuntu/

http://blog.csdn.net/jw083411/article/details/8940574