you first have to get your ODBC config set up.   Try out "iodbctest", which 
should be on your mac, and see if you can establish a connection to the 
database.    It matters if you're using FreeTDS or some other driver system.

FreeTDS docs/etc. are at http://www.freetds.org/ .




On Sep 29, 2010, at 1:34 PM, Mark Sharp wrote:

> I am trying to establish a connection to a database provided by Microsoft SQL 
> Server 2008 on our local network. The traceback seems to indicate that pyodbc 
> is not being found, but this is my first attempt to use SQLAlchemy with a 
> database other than sqlite so there are many holes in my understanding.
> 
> The server is "hellcat"
> The instance is "cohiba"
> The user is "userA"
> The password is "usera$dbo"
> 
> I installed pyodbc
> benjy:pyodbc-2.1.8 msharp$ python setup.py build install
> running build
> running build_ext
> building 'pyodbc' extension
> creating build
> creating build/temp.macosx-10.6-universal-2.6
> ...
> Installed 
> /Library/Python/2.6/site-packages/pyodbc-2.1.8-py2.6-macosx-10.6-universal.egg
> Processing dependencies for pyodbc==2.1.8
> Finished processing dependencies for pyodbc==2.1.8
> 
> 
> benjy:python msharp$ python
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sqlalchemy
>>>> sqlalchemy.__version__
> '0.6.4'
>>>> mssql_db = 
>>>> sqlalchemy.create_engine('mssql+pyodbc://userA:usera$...@[hellcat\cohiba]')
>>>>  # I have tried this with and without the brackets (that is, 
>>>> ......@hellcat\cohiba and ......@[hellcat\cohiba])
>>>> connection = mssql_db.connect()
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/engine/base.py",
>  line 1814, in connect
>    return self.Connection(self, **kwargs)
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/engine/base.py",
>  line 835, in __init__
>    self.__connection = connection or engine.raw_connection()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/engine/base.py",
>  line 1877, in raw_connection
>    return self.pool.unique_connection()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 143, in unique_connection
>    return _ConnectionFairy(self).checkout()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 370, in __init__
>    rec = self._connection_record = pool.get()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 214, in get
>    return self.do_get()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 733, in do_get
>    con = self.create_connection()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 148, in create_connection
>    return _ConnectionRecord(self)
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 254, in __init__
>    self.connection = self.__connect()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/pool.py",
>  line 320, in __connect
>    connection = self.__pool._creator()
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/engine/strategies.py",
>  line 76, in connect
>    return dialect.connect(*cargs, **cparams)
>  File 
> "/Library/Python/2.6/site-packages/SQLAlchemy-0.6.4-py2.6.egg/sqlalchemy/engine/default.py",
>  line 249, in connect
>    return self.dbapi.connect(*cargs, **cparams)
> sqlalchemy.exc.DBAPIError: (Error) ('IM002', '[IM002] [iODBC][Driver 
> Manager]Data source name not found and no default driver specified. Driver 
> could not be loaded (0) (SQLDriverConnectW)') None None
> 
> Mark Sharp
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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