Connect to MSSQL Database using Flask-SQLAlchemy

前端 未结 6 532
天涯浪人
天涯浪人 2020-12-09 05:02

I\'m trying to connect to a local MSSQL DB through Flask-SQLAlchemy.

Here\'s a code excerpt from my __init__.py file:

from flask import          


        
6条回答
  •  眼角桃花
    2020-12-09 05:24

    using below solution i get resolve my connection issue with MSSQL server

    params = urllib.parse.quote_plus('DRIVER={SQL Server};SERVER=HARRISONS-THINK;DATABASE=LendApp;Trusted_Connection=yes;')
    app.config['SQLALCHEMY_DATABASE_URI'] = "mssql+pyodbc:///?odbc_connect=%s" % params
    

    If you are getting any Login failed for User error then please go to this http://itproguru.com/expert/2014/09/how-to-fix-login-failed-for-user-microsoft-sql-server-error-18456-step-by-step-add-sql-administrator-to-sql-management-studio/.

提交回复
热议问题