I have a problem: I connected to DB on one server (the one thats app is running) and it works fine. But if I want to connect to other DB on other server, it doesn't work - 500 error pops up. It seems like there's a problem even with connecting to DB (have done some tests). I am using SQL Server 2012 and have no idea what to do next.
Some infos:
servers can't connect to internet so every installation is a painfull process
on the first one my web app is running
on the second server I have nothing - no python, no flask, no anaconda. There's only my wanted DB and SQL Server 2012.
already enabled Windows Authenticaton on second server
on usual computer as a running program everything works pretty well
Is it even possible to use two connection to two different servers? Do I have to install python and pyodbc on second server to make it work?
Below I show snippet of code:
conn = pyodbc.connect('Driver={SQL Server Native Client 11.0};'
'Server=whatever1;'
'Database=whatever2;'
'Trusted_Connection=yes;')
cursor = conn.cursor()
cursor.execute("SELECT column1, column2 FROM dbo.database1")
kursor = cursor.fetchall()
for row1 in kursor:
...
cursor.close()
conn2 = pyodbc.connect('Driver={SQL Server Native Client 11.0};'
'Server=whatever3;'
'Database=whatever4;'
'Trusted_Connection=yes;')
cursor = conn2.cursor()
cursor.execute("SELECT column1 FROM dbo.database2")
"""
sth = cursor.fetchone()
...
cursor.close()
conn.close()
conn2.close()
Tried a lot, nothing helped. Thanks from the bottom of my heart for very tip!
EDIT
I think I have tried everything that came to my mind and visited every possible website taht I have thought it had solution somewhere. Since I wrote this post, I discovered things:
the problem is surely with connection with server no 2, because I discovered possibility of getting error logs and error has a 'Login failed for user 'Domain\Server$' ' so that's for sure
the login thats in logs doesn't exist in tab Security in Logins, and I don't know to which it belongs so that I don't know who should get appropriate permissions and how to do that
in logs in ms sql server on the 2nd server I found the reason: Could not find a login matching the name provided.
Windows Authentication enabled on both, and also - when I run a program which connects to the SQL Server (the second one) and it is run on the first server (where the app runs) it works pretty well and no error, using trusted_connection = yes
Any ideas what can be the cause? I am struggling with this for so long that I have already started to visit same places and asking same questins on and on, and still no answer on the horizon.
Thanks buds for every tip!