0

Python ライブラリ pymssql を使用してデータベースに接続しています。以前に使用したことがないため、エラーは些細に見えるかもしれません。

from os import getenv
import pymssql

server = getenv("192.xxx.xxx.xx") 
user = getenv("john.constantine")
password = getenv("xxxxxxx")

conn = pymssql.connect(server, user, password, "tempdb")
cursor = conn.cursor()

cursor.execute('SELECT * from table')
rows = cursor.fetchall()
for row in rows:
    print row

conn.close()

次のエラーが表示されます。

Traceback (most recent call last):
  File "C:\Users\Documents\Demo_DB.py", line 8, in <module>
    conn = pymssql.connect(server, user, password, "tempdb")
  File "pymssql.pyx", line 635, in pymssql.connect (pymssql.c:10734)
  File "_mssql.pyx", line 1902, in _mssql.connect (_mssql.c:21821)
  File "_mssql.pyx", line 552, in _mssql.MSSQLConnection.__init__ (_mssql.c:5891)
TypeError: argument of type 'NoneType' is not iterable
[Finished in 0.2s with exit code 1]

これらの資格情報を使用して DB に接続します。 ここに画像の説明を入力

4

0 に答える 0