hello everyone,
i have a problom with pymssql connect mssql server .please help me to sovle
it.thx
code:
connect_str = r"mssql+pymssql://"
connect_str += r"%s:%s@%s:%s/%s?charset=%s" % (self.username,
self.password, self.ip, self.port, self.db_name, self.get_encode_display())
engine = sqlalchemy.create_engine(db_connect_str)
Session = sqlalchemy.orm.sessionmaker(bind=engine)
session = Session()
data = session.execute(sql_str)
backtrack:
File
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line
170, in initialize
self._get_server_version_info(connection)
File
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/mssql/pymssql.py",
line 72, in _get_server_version_info
r"Microsoft SQL Server.*? - (\d+).(\d+).(\d+).(\d+)", vers)
File "/usr/lib/python2.7/re.py", line 137, in match
return _compile(pattern, flags).match(string)
TypeError: expected string or buffer
i print vers, it's None.
but,i try it in shell,
~$ sqsh -U sa -P 123456 -S 192.168.1.21
1> select @@version
2> go
----------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-----------------------
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
Jul 9 2008 14:43:34
Copyright (c) 1988-2008 Microsoft Corporation
Enterprise Evaluation Edition on Windows NT 5.1 <X86> (Build 2600:
Service Pack 3)
(1 row affected)
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.