0

In Pycharm I have prepared data in dataframe which i intend to insert in SQL Server using sqlalchemy. I have done like below

engine = create_engine("mssql+pyodbc://<ServerName>:<Port>/<DatabaseName>/driver=ODBC+Driver+17+for+SQL+Server")
df.to_sql('TableName', con=engine, if_exists='append')

but I keep getting below error.

return self.dbapi.connect(*cargs, **cparams) sqlalchemy.exc.InterfaceError: (pyodbc.InterfaceError) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

What is mistake I am making? I am able to connect using pyodbc.connect so access should not be issue.

Dale K
  • 25,246
  • 15
  • 42
  • 71
Pritesh
  • 1,938
  • 7
  • 32
  • 46
  • Does this answer your question? [\[Microsoft\]\[ODBC Driver Manager\] Data source name not found and no default driver specified](https://stackoverflow.com/questions/17115632/microsoftodbc-driver-manager-data-source-name-not-found-and-no-default-drive) – Charlieface Nov 24 '21 at 09:49
  • Try using `?driver=` instead of `/driver=` – Gord Thompson Nov 24 '21 at 13:30

0 Answers0