Wednesday, January 3, 2018

python pymssql connect seems to ignore database string argument

python pymssql connect seems to ignore database string argument




python - pymssql.connect() seems to ignore database string argument -

i have 3 dbs in azure tried connecting 1 of them.

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 name of db (which should "my_db") result = cursor.fetchone() print result

but ive got "master" default azure database. shouldnt happen because ive specify databse string argument "my_db".

please advice.

your problem version of pymssql. latest version on pip 2.1.0, version supports azure 2.1.1. so, if install source, work. also, create sure have freetds > 0.91

python sql azure pymssql

go to link download
download
alternative link download

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.