Hello,
In a recent zope project I’m obliged to use an mssql database. So I test first an installation with a windows server os. Everything is ok when I configure the good port (1433) and open tcpip connection in sql management and stop firewall.
But when I try to connect with pymssql in unix I have some problem.
When I launch a connection to mssql I have this error:
>>> _mssql.connect("host","user", "password")
Traceback (most recent call last):
File "<console>", line 1, in ?
MssqlDatabaseException: DB-Lib error message 20009, severity 9:
Unable to connect: Adaptive Server is unavailable or does not exist
Net-Lib error during Operation now in progress Error 36 - Operation now in progress
Yahoo , I’m very happy.
In google , no good post about this problem, so I’m very desappointed. I know that pymssql on unix work with freedts which is an implementation of the protocol which use mssql.
When you install freedts you install also some utility. It’s located in bin. Some of it named tsql. You can use it to test your connection. As pymssql is an wrapper to freedts (in unix) and if tsql don’t work I suppose pymssql also. So I try with this command and I have exactly the same results :
mac:bin yboussard$ ./tsql -H myip -p 1433 -U myuser locale is "fr_FR.UTF-8" locale charset is "UTF-8" Password: Msg 20017, Level 9, State -1, Server OpenClient, Line -1 Unexpected EOF from the server Msg 20002, Level 9, State -1, Server OpenClient, Line -1 Adaptive Server connection failed There was a problem connecting to the server
So I’m very again very happy and reassure that I’m in the good way.
In read documentation about freedts and we can debug connection in setting environment variable TDSDUMP=/tmp/freetds.log. So now when I launch an connection I log in freetds.log. I see in this file the tds version used by the connection and I see it was incorrect (tds version is 5) in accordance with that documentation.
So I use an another environnement variable to fix that :
export TDSVER=7.0
And miracle , everything work with tsql. So I force version of tds in my ~/.freetds.conf in global section as this
[global] tds version = 7.0
And after that everything is ok in python. Yahoo!!. I hope that ticket will be useful for you.
Regards Youenn.
March 4, 2009 at 3:42 pm
Thanks for the hint, it solved my problem!
March 6, 2009 at 5:18 pm
Very useful thank you!
Not the same problem but you pointed out what I was missing:
TDSDUMP=/tmp/freetds.log
a debug log!
I compiled freetds by my own. Probably I forgot some flag because I was using port 4000. I changed to standard value 1433 in freetds.conf and everything went fine.
Ciao,
A
April 15, 2009 at 2:34 pm
I noticed that this is not the first time you write about this topic. Why have you decided to write about it again?
April 15, 2009 at 3:09 pm
why you did you say that. I don’t understand
May 1, 2009 at 1:44 pm
[...] overriden by a file in you userpath? /home/username.freetds.conf a google of that errormessage install pymssql and how to deal with DB-Lib error message 20009, severity 9 « PyYou Weblog [...]
May 8, 2009 at 6:55 pm
thank you yboussard..
fixed my issue.
cheers
May 29, 2009 at 11:01 am
worked a treat, thank you!
June 25, 2009 at 2:54 pm
Many thanks for posting this.
August 7, 2009 at 6:30 pm
Sweet! Just what I needed. Thanks.
September 11, 2009 at 8:24 pm
Great tip! Having spent hours trying to figure out what an “EOF error” meant, this page at least gave me a fix: once I set “export TDSVER=8.0″ it worked. Thanks!
September 18, 2009 at 12:22 am
Thanks!