I've been banging my head against this problem for a couple of hours. To sum it up, I've been trying to connect to a locally hosted MSSQL server using the following code.
server = r'DESKTOP-XXXXX/TEST2'
user = r'DESKTOP-XXXXXYYYYYY'
password = r'something'
db = r'flask_test'
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "mssql+pymssql://" + user + ":" + password + "@" + server + "/" + db
Now as far as I can tell, the problem is with the fact that the server and database on the last line are separated by an '/', which is also present in the server name. As a result, it believes the server name is just DESKTOP-XXXXX, as shown by the error below, when I'm trying to connect to DESKTOP-XXXXX/test2.
I've tried changing it to a not raw string, changing the slash direction, just entering TEST2, and many other things but I'm at a loss now. Any help would be appreciated! Sorry if it seems like a silly problem.
File "src\pymssql\_pymssql.pyx", line 652, in pymssql._pymssql.connect
sqlalchemy.exc.OperationalError: (pymssql._pymssql.OperationalError) (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (DESKTOP-202JPF7)\nNet-Lib error during Unknown error (10061)\nDB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (DESKTOP-XXXXX)\nNet-Lib error during Unknown error (10061)\n')