Port has to be added to the connection string with pyodbc, the same
way as adodbapi and pymssql
def make_connect_string(self, keys):
connectors = [Driver={SQL Server}]
if keys.has_key(port):
keys[host] = keys[host] + , + str(keys[port])
del keys[port]
On 28 mar, 12:30, Paul Johnston [EMAIL PROTECTED] wrote:
Hi,
The bit applicable toadodbapidoesn't consider the port at all (at the
moment...)
Check the current trunk, if port is specified, the port key is deleted
and its value added to the key host with ''.join([keys.get('host',
''), ':',
Ok I saw fixes in the current trunk:
class MSSQLDialect_pymssql(MSSQLDialect):
def make_connect_string(self, keys):
if keys.get('port'):
# pymssql expects port as host:port, not a separate arg
keys['host'] = ''.join([keys.get('host', ''), ':',
I found that the conenctionString is not complete, the port is
missing. Not like anywhere else, host and port must be separated by a
comma !
def make_connect_string(keys):
connectors = [Provider=SQLOLEDB]
connectors.append (Data Source=%s,%s % (keys.get(host),
keys.get(port, 1433)))
I also found that when trying to connect within a thread the
connection hangs. I had to use pythoncom.CoInitialize().
Example:
#
import pythoncom
import sys
sys.coinit_flags = 0
pythoncom.CoInitialize()
[ COM code here... ]
pythoncom.CoUninitialize()
More informations: