Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import pymssql
  2.  
  3. conn = pymssql.connect(host="hostname", user="username@hostname", password="pass", database="dbname")
  4. cursor = conn.cursor()
  5. cursor.execute('SELECT * FROM SalesLT.Customer WHERE CustomerID=%d', 1)
  6. row = cursor.fetchone()
  7. while row:
  8. print("ID=%d, Name=%s" % (row[0], row[3]))
  9. row = cursor.fetchone()
  10.  
  11. conn.close()
  12.  
  13. export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1
  14. pip install pymssql
  15.  
  16. Traceback (most recent call last):
  17. File "test.py", line 8, in <module>
  18.  
  19. conn = pymssql.connect(host="hostname",user="username@hostname",password="pass",database="dbname")
  20.  
  21. File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10824)
  22. pymssql.OperationalError: (20002, 'DB-Lib error message 20002, severity 9:nAdaptive Server connection failedn')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement