?文章來源地址http://www.zghlxwxcb.cn/news/detail-672066.html
python代碼
'''
Author: tkhywang 2810248865@qq.com
Date: 2023-08-21 11:22:24
LastEditors: tkhywang 2810248865@qq.com
LastEditTime: 2023-08-21 11:29:30
FilePath: \PythonProject02\Microsoft SQL Server 數(shù)據(jù)庫.py
Description: 這是默認(rèn)設(shè)置,請?jiān)O(shè)置`customMade`, 打開koroFileHeader查看配置 進(jìn)行設(shè)置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
import pymssql as pymssql
# 連接數(shù)據(jù)庫
conn = pymssql.connect('192.168.121.130', 'sa', 'Aa123456789', 'jiradb')
# 執(zhí)行查詢
cur = conn.cursor()
cur.execute("SELECT * FROM t_tidb")
# 獲取結(jié)果
rows = cur.fetchall()
for row in rows:
print(row)
# 關(guān)閉連接
cur.close()
conn.close()
文章來源:http://www.zghlxwxcb.cn/news/detail-672066.html
?
到了這里,關(guān)于python連接Microsoft SQL Server 數(shù)據(jù)庫的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!