Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#95 connectionForURI fails for mssql on Cygwin

closed-invalid
Oleg Broytman
None
5
2008-03-03
2008-02-29
Anonymous
No

when running connectionForURI on
connection_string='mssql://user:password@host:port/database'
the pymssql.connect is called with "host" (port is stripped)
however, the called _mssql.connect() (pymssql:line 329) doesn't work unless the port is also specified.
Here's the trace:

Traceback (most recent call last):
File "<stdin>", line 28, in <module>
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/main.py", line 880, in get
val._init(id, connection, selectResults)
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/main.py", line 919, in _init
selectResults = self._connection._SO_selectOne(self, dbNames)
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/dbconnection.py", line 514, in _SO_selectOne
return self._SO_selectOneAlt(so, columnNames, so.q.id==so.id)
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/dbconnection.py", line 524, in _SO_selectOneAlt
clause=condition)))
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/dbconnection.py", line 380, in queryOne
return self._runWithConnection(self._queryOne, s)
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/dbconnection.py", line 248, in _runWithConnection
conn = self.getConnection()
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/dbconnection.py", line 259, in getConnection
conn = self.makeConnection()
File "/usr/lib/python2.5/site-packages/SQLObject-0.10.0b3-py2.5.egg/sqlobject/mssql/mssqlconnection.py", line 83, in makeConnection
con = self.dbconnection( *self.make_conn_str(self) )
File "/usr/lib/python2.5/site-packages/pymssql.py", line 328, in connect
con = _mssql.connect(dbhost, dbuser, dbpasswd)
_mssql.error: DB-Lib error message 20009, severity 9:
Server is unavailable or does not exist.

my quick correction replaces
con = _mssql.connect(dbhost, dbuser, dbpasswd)
to
con = _mssql.connect(dbhost+":1433", dbuser, dbpasswd)

Thank you.

Discussion

  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    Logged In: YES
    user_id=4799
    Originator: NO

    You've patched pymssql which is not a part of SQLObject. I think you should report the problem to pymssql authors, no?

     
  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    • assigned_to: nobody --> phd
    • status: open --> open-wont-fix
     
  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    • status: open-wont-fix --> closed-invalid