[sqlalchemy] Re: Fix on ADODBAPI
Hi, The bit applicable to adodbapi doesn't consider the port at all (at the moment...) class MSSQLDialect_adodbapi(MSSQLDialect): ... def make_connect_string(self, keys): connectors = [Provider=SQLOLEDB] connectors.append (Data Source=%s % keys.get(host)) connectors.append (Initial Catalog=%s % keys.get(database)) user = keys.get(user) if user: connectors.append(User Id=%s % user) connectors.append(Password=%s % keys.get(password, )) else: connectors.append(Integrated Security=SSPI) return [[;.join (connectors)], {}] Paul El Gringo wrote: 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', ''), ':', str(keys['port'])]) del keys['port'] return [[], keys] I guess the right separator is not ':' but ','. G just a way from MS to disagree from standarts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Fix on ADODBAPI
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', ''), ':', str(keys['port'])]) . The problem is the ':' wich must be a coma for an adodb connection string. check http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx. server=tcp:servername, portnumber --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Fix on ADODBAPI
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', ''), ':', str(keys['port'])]) del keys['port'] return [[], keys] I guess the right separator is not ':' but ','. G just a way from MS to disagree from standarts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Fix on ADODBAPI
Hi, That doesn't work for me - it makes create_engine() hang for ages then fail. I wonder if this is because without a port, the driver first tries a named pipe connection. If you are keen to include this functionality, you'll have to do a bit more ground work. The other issue you mention, with CoInitialize(), I have hit as well. I see this as an adodbapi bug, and unfortunately adodbapi is not maintained any more. This issue and others pushed me to pyodbc, which is working great. Paul El Gringo wrote: 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))) connectors.append (Initial Catalog=%s % keys.get(database)) user = keys.get(user) if user: connectors.append(User Id=%s % user) connectors.append(Password=%s % keys.get(password, )) else: connectors.append(Integrated Security=SSPI) return [[;.join (connectors)], {}] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Fix on ADODBAPI
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: http://twistedmatrix.com/pipermail/twisted-python/2004-June/007997.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---