I am trying to connect to a SQL Database hosted in Windows Azure through MySQLdb with Python.
I keep getting an error mysql_exceptions.OperationalError: (2001, 'Bad connection string.')
This information works when connecting through .NET (vb, C#) but I am definitely not having any luck here.
For below I used my server's name from azure then .database.windows.net Is this the correct way to go about this?
Here is my code:
#!/usr/bin/python
import MySQLdb
conn = MySQLdb.connect(host="<servername>.database.windows.net", user="myUsername", passwd="myPassword", db="db_name")
cursor = conn.cursor()
I have also tried using pyodbc with FreeTDS with no luck.
user="myUsername@<servername>". - Gaurav Mantriuser="myUsername@<servername>"Now it's saying mysql_exception.OperationalError: (2002, 'Internal error.') - Kyle Moffatpymssql? All the examples I have seen makes use of this. - Gaurav Mantriconn = pymssql.conect(host="<servername>.database.windows.net", user="myUsername", password="myPassword", database="db_name")I get "Operation now in progressDB-Lib error message 20002, severity 9: Adaptive Server connection failed - Kyle Moffatmysqldbis an interface to MySQL. Azure's SQL Database Service is a SQL Server variant, not a MySQL variant. You need to choose a library that works with SQL Server, not MySQL. And which you choose (such as the one Gaurav suggested) is up to you. Also: if you're going to change library, edit your question - don't put additional detail as comments. Very hard to read, very hard to get the new context of your question. - David Makogon