I am trying to access MS SQL server from python.
I installed pymssql and this is my code
import pymssql
conn = pymssql.connect(host='SAM-WOLPTP\SAM', user='SAM', password='password', database='test')
cur = conn.cursor()
cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))')
cur.executemany("INSERT INTO persons VALUES(%d, %s)", \
[ (1, 'John Doe'), (2, 'Jane Doe') ])
conn.commit() # you must call commit() to persist your data if you don't set autocommit to True
conn.close()
While running the program I am getting this error:
pymssql.InterfaceError: Connection to the database failed for unknown reason