回答編集履歴
2
追記
answer
CHANGED
@@ -23,4 +23,13 @@
|
|
23
23
|
|
24
24
|
#conn.commit()
|
25
25
|
conn.close()
|
26
|
+
```
|
27
|
+
|
28
|
+
問題を`Python`から切り離す
|
29
|
+
-----
|
30
|
+
とりあえずコマンドプロンプトにて以下を実行し成功するかを試してみてはいかがでしょうか?
|
31
|
+
```DOS
|
32
|
+
C:\Windows\system32>sqlcmd -S .\MSSQLSERVER
|
33
|
+
;あるいは既定のインスタンスなら以下のように名前なしで試してみる
|
34
|
+
C:\Windows\system32>sqlcmd -S localhost
|
26
35
|
```
|
1
コード修正
answer
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
# pymssql=2.1.4
|
10
10
|
|
11
11
|
import pymssql
|
12
|
-
conn = pymssql.connect(server='.\
|
12
|
+
conn = pymssql.connect(server='.\HOGE_INSTANCE', user='hoge_user', password='hoge_pwd', database='DB_HOGE')
|
13
13
|
cursor = conn.cursor()
|
14
14
|
|
15
15
|
cursor.execute('select id, name from t_test order by id')
|