On Mon, Mar 31, 2008 at 2:07 PM, Rick Morrison <[EMAIL PROTECTED]> wrote:
>
> >
> >
> >
> > You didn't say how am I supposed to use it in create engine?
> >
>
> http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_options
>
>
> >
> > Anyway. I went into sqlalchemy/databases/mssql.py
> > changed the line 791 to: self.drivername = params.get('driver', 'TDS')
> > but I still get the:
> >
> >
>
> OK, continuing, then try adding on line 826 (right before the function
> return) this statement
>
> print ';'.join(connectors)
>
Here is what I get.
The problem seems to be in a port part of a connection.
Here is what your print statement shows:
DRIVER={SQL Server};Server=xxxx,1433;Database=xxx;UID=xxx;PWD=xxx
>>> e.echo=True
>>> metadata=sqlalchemy.MetaData(e)
>>> pm = sqlalchemy.Table('xxxx', metadata, autoload=True)
File "sqlalchemy/engine/strategies.py", line 80, in connect
raise exceptions.DBAPIError.instance(None, None, e)
SystemError: 'finally' pops bad exception
import pyodbc
c=pyodbc.connect('DRIVER={SQL
Server};Server=xxx,1433;Database=xxx;UID=xxx;PWD=xxx')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
<type 'instance'>: ('08001', '[08001] [unixODBC][FreeTDS][SQL
Server]Unable to connect to data source (0)')
I also tried
>>> c=pyodbc.connect("DRIVER={SQL
Server};Server=xxx:1433;Database=xxx;UID=xxx;PWD=xx")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
<type 'instance'>: ('08001', '[08001] [unixODBC][FreeTDS][SQL
Server]Unable to connect to data source (0)')
Finally I tried:
>>> c=pyodbc.connect("DRIVER={SQL
Server};Server=xxx;Database=xxx;UID=xxx;PWD=xx")
I am able to connect.
So I modified line 816:
connectors.append('Server=%s,%d' % (keys.get('host'), keys.get('port')))
to
connectors.append('Server=%s' % (keys.get('host')))
and I am able to connect to mssql on unixodbc via sqlalchemy.
I tried looking at pyodbc page to find proper way to include port, but
I couldn't find one.
Lucas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---