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 数据库.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
import pymssql as pymssql
# 连接数据库
conn = pymssql.connect('192.168.121.130', 'sa', 'Aa123456789', 'jiradb')
# 执行查询
cur = conn.cursor()
cur.execute("SELECT * FROM t_tidb")
# 获取结果
rows = cur.fetchall()
for row in rows:
print(row)
# 关闭连接
cur.close()
conn.close()