Issue 273: Can't connect via FreeTDS without exactly passed PORT parameter
Status:  NoFix
Owner: ----
Closed:  Sep 2012
Reported by av1024@gmail.com, Jun 28, 2012
What steps will reproduce the problem?
1.Try connect to MS SQL via unixodbc/freetds with DSN-less connection string like "DRIVER=FreeTDS;Server=my.server;UID=username;PWD=secret" without passing "port" parameter

What is the expected output? What do you see instead?
Expected: connection object
See: Exception: Operation failed with [08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)

What version of the product are you using? On what operating system?
Linux Mint Maya (ubuntu 12.04) x86_64, 2.7.3
pyodbc 3.0.6 installed via pip
no freetds variables (like TDSPORT) are set in environ

Please provide any additional information below.
Looks like pyodbc does not use or hides default port from freetds config: when python invoked like 'env TDSPORT=1433 python' or port specified in connection string all worked as expected.

Jun 28, 2012
#1 av1024@gmail.com
The same connection string was worked at least in 2.1.7 under ubuntu 11.04/32 bit
Jul 1, 2012
Project Member #2 mkleehammer
pyodbc doesn't do anything with environment variables.  This is up to the driver.  There are a lot of changes between pyodbc 2.1.7 and 3.0.6, but nothing that should cause this.

Are you saying that the *only* thing changed is pyodbc?  Are you using the exact same driver and test script?

I can't think of anything that would cause this other than a driver change.

Also, I've been recommending the use of Microsoft's SQL Server driver for Linux where possible, just because there are a lot of bugs in FreeTDS.
Status: Investigating
Jul 1, 2012
#3 av1024@gmail.com
Good idea!

After uninstaling lastest pydbc and replace them by 2.1.7 from ubuntu repository my script still does not work without 'port=1433'. 

So its look like some changes in freetds/pyodbc/distro… 

I can't user Microsoft's driver because it is not installable under debian (
Jul 17, 2012
#4 dkleeham...@gmail.com
SQL Server Driver for Linux can be installed under Debian.

Here is a post explaining how to do it on Debian/Ubuntu from this past December (like mkleehammer said, it is much more stable):
http://www.codesynthesis.com/~boris/blog/2011/12/02/microsoft-sql-server-odbc-driver-linux/

Jul 17, 2012
#5 av1024@gmail.com
Thanks for information.

I know this method. It is so complex for our cutomers for now... :( 
Sep 27, 2012
Project Member #6 mkleehammer
Closing since it is a FreeTDS issue.  Good luck.
Status: NoFix