【发布时间】:2014-10-16 10:14:30
【问题描述】:
我在 Azure 中有 3 个数据库,我尝试连接到其中一个。
conn = pymssql.connect(server='hostname.database.windows.net',
user='username@hostname',
password='*****',
database='my_db',
timeout=0,
login_timeout=60,
charset='UTF-8',
as_dict=False,
host='',
port='1433')
cursor = conn.cursor()
cursor.execute('select db_name()') #to get the name of my db (which should be "my_db")
result = cursor.fetchone()
print result
但我得到的是“master”,它是默认的 Azure 数据库。这不应该发生,因为我已经为“my_db”指定了“databse”字符串参数。
请指教。
【问题讨论】: