I am trying to connect to a SQL Server 2012 database using SQLAlchemy (with pyobbc) on Python 3.3 (Windows 7-64-bit). I can connect using direct pyobbc, but failed to connect using SQLAlchemy. I have a dsn file setup to access a database.
I successfully connect using direct pyodbc as follows:
con = pyodbc.connect('FILEDSN=c:\\users\\me\\mydbserver.dsn')
For sqlalchemy, I tried:
import sqlalchemy as sa engine = sa.create_engine('mssql+pyodbc://c/users/me/mydbserver.dsn/mydbname')
The create_engine method does not actually establish a connection and fails, but iI if I try something that calls sqlalchemy to actually configure the connection (for example, engine.table_names() ), it will take some time, but then returns this error:
DBAPIError: (Error) ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) (SQLDriverConnect)') None None
I'm not sure what is going wrong how to see which connection string is really being passed to pyodbc by sqlalchemy. I am successfully using the same sqlalchemy classes with SQLite and MySQL.
Thanks in advance!
python sql-server sqlalchemy pyodbc
Brad campbell
source share