Where is FreeTDS installed when I download pymssql

2019-05-20 08:18发布

问题:

I am having trouble connecting pymssql to my local instance of MSSQL, and would like to use the tsql debugging command that is included with FreeTDS. However, I am unable to find where it FreeTDS is installed. As far as I know, it comes pre-compiled with pymssql on windows, I just don't know where it is.

More info:

  • I am using windows
  • I am not using a virtual environment
  • I used the package manager included with PyCharm to install pymssql (I assume it wraps pip)

回答1:

AKAIK, pymssql for Windows doesn't come bundled with FreeTDS. If anything, IIRC, it uses the Windows SQL Server driver. To use FreeTDS instead, you'd have to download and install it:

http://sourceforge.net/projects/freetdswindows/

By default, the latest version will install to c:\freetds-0.95rc2

Please see my above comment as well. I'll amend this answer if necessary with more information. Good luck!

UPDATE:

You can connect to SQL Server if you're on Windows using the native drive through pyodbc like this:

DRIVER={SQL Server};SERVER=yourserver;PORT=1433;DATABASE=yourdb;UID=dbuser;PWD=dbpassword

You may have better luck with that if the FreeTDS installation doesn't work for you.