methew / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Can't connect via FreeTDS without exactly passed PORT parameter #273

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by av1024@gmail.com on 28 Jun 2012 at 7:50

GoogleCodeExporter commented 9 years ago
The same connection string was worked at least in 2.1.7 under ubuntu 11.04/32 
bit

Original comment by av1024@gmail.com on 28 Jun 2012 at 7:51

GoogleCodeExporter commented 9 years ago
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.

Original comment by mkleehammer on 1 Jul 2012 at 3:48

GoogleCodeExporter commented 9 years ago
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 (

Original comment by av1024@gmail.com on 2 Jul 2012 at 5:28

GoogleCodeExporter commented 9 years ago
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-dr
iver-linux/

Original comment by dkleeham...@gmail.com on 17 Jul 2012 at 6:35

GoogleCodeExporter commented 9 years ago
Thanks for information.

I know this method. It is so complex for our cutomers for now... :( 

Original comment by av1024@gmail.com on 18 Jul 2012 at 5:35

GoogleCodeExporter commented 9 years ago
Closing since it is a FreeTDS issue.  Good luck.

Original comment by mkleehammer on 27 Sep 2012 at 8:24