You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have successfully connected the Azure SQL Server using AccessToken in the pyodbc. Here I didn't use a username or password to connect to the database. Instead of that, I used attrs_before for pass token. Here I am generating the token automatically.
accessToken = bytes(get_bearer_token("https://database.windows.net/"), 'utf-8');
exptoken = b"";
for i in accessToken:
exptoken += bytes({i});
exptoken += bytes(1);
tokenstruct = struct.pack("=i", len(exptoken)) + exptoken;
conn = pyodbc.connect(
"Driver={ODBC Driver 17 for SQL Server};Server=yoursqlserver.database.windows.net,1433;Database=dbName",
attrs_before={1256: bytearray(tokenstruct)});
Now the problem is how to use the same configuration using this package to connecting DB? We can't have a username or password to connect the database when using the azure token.
The text was updated successfully, but these errors were encountered:
I have successfully connected the Azure SQL Server using AccessToken in the pyodbc. Here I didn't use a username or password to connect to the database. Instead of that, I used attrs_before for pass token. Here I am generating the token automatically.
Token Generation:
Pyodbc Connection:
Now the problem is how to use the same configuration using this package to connecting DB? We can't have a username or password to connect the database when using the azure token.
The text was updated successfully, but these errors were encountered: