I have a python script running on python 2.7 in CentOS 2.6 that connects to a Sql erver database:
pyodbc.connect("DRIVER=FreeTDS;SERVER=someServer;DATABASE=someDb;UID=myUser;PWD=superSecret;CHARSET=UTF8;TDS_Version=7.2")
That call will fail with the following: pyodbc.Error: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
The freetds trace will say login.c:436:invalid port number
Adding PORT=1433;
will cause the connection to succeed even though that is the default port number, and I added the following to my freetds.conf:
[global] # TDS protocol version tds version = 7.0 port = 1433
How do I make FreeTDS try port 1433 as the default port so I don't have to set it in the query string?