On Tue, Apr 7, 2009 at 2:58 PM, Lukasz Szybalski <szybal...@gmail.com> wrote:
> Hello,
>
> Is this still proper connection string for mssql where I specify the
> tds version and a connection driver name?
>
>  e = 
> sqlalchemy.create_engine("mssql://user:p...@server:1433/db_name?driver=TDS&odbc_options='TDS_Version=8.0'")
>

1. Just to let you know... the dsn connection works as long as
"TDS_Version = 8.0" is provided in the dsn settings of freetds for
mssql 2000.

2. I went over your sampeles at :
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/lib/sqlalchemy/databases/mssql.py

and using the mssql:///?odbc_connect=dsn%3Dmydsn%3BDatabase%3Ddb
I was able to get proper dns string.

The syntax is weird because the code needs to look like this and needs
to use "%s" to substitute the string. I don't know if you run into
unicode problems or escaping issues. Is there a better way to do this?

import urllib
url= 
urllib.quote_plus('DRIVER={TDS};Server=servername;Database=dbname;UID=user;PWD=pass;port=123;TDS_Version=8.0;')
e = sqlalchemy.create_engine("mssql:///?odbc_connect=%s" % url)



I wish you guys did this in a code so I could only provide something like this:
e = 
sqlalchemy.create_engine("mssql:///?odbc_connect='DRIVER={TDS};Server=servername;Database=dbname;UID=user;PWD=pass;port=123;TDS_Version=8.0;''")

Notice the single quotes after odbc_connect='
If not could you copy above 3 lines of code I've put as an example and
add it to your docs for mssql. I would never know how to get here
without being subscribed to this list and know about the changes and
know to look at the source code file.


3. With dsn-less connection there seems to be some kind of issue with
pyodbc, but I can't figure out what the problem is.

import pyodbc
 
pyodbc.connect('DRIVER={TDS};Server=servername;Database=dbname;UID=user;PWD=pass;port=123;')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyodbc.Error: ('08S01', '[08S01] [unixODBC][FreeTDS][SQL Server]Unable
to connect: Adaptive Server is unavailable or does not exist (20009)
(SQLDriverConnectW)')

Anybody might know how to solve this?

Thanks,
Lucas




> What is the syntax for driver, and how can I pass "TDS_Version=8.0" to
> the end of connection string?
>
> Thanks,
> Lucas
>
>
> File 
> "/home/lucas/tmp/saENV/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/pool.py",
> line 198, in __init__
>    self.connection = self.__connect()
>  File 
> "/home/lucas/tmp/saENV/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/pool.py",
> line 261, in __connect
>    connection = self.__pool._creator()
>  File 
> "/home/lucas/tmp/saENV/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/engine/strategies.py",
> line 80, in connect
>    raise exc.DBAPIError.instance(None, None, e)
> sqlalchemy.exc.DBAPIError: (Error) ('08001', '[08001]
> [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0)
> (SQLDriverConnectW)') None None
>
>
>
>
> --
> How to create python package?
> http://lucasmanual.com/mywiki/PythonPaste
> DataHub - create a package that gets, parses, loads, visualizes data
> http://lucasmanual.com/mywiki/DataHub
>



-- 
How to create python package?
http://lucasmanual.com/mywiki/PythonPaste
DataHub - create a package that gets, parses, loads, visualizes data
http://lucasmanual.com/mywiki/DataHub

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to