pyodbc Azure transient error - python-3.x

My script is listed below:
import pyodbc
cnxn = pyodbc.connect(driver=driver,
server=server,
user=username,
database=database,
Trusted_Connection='yes',
autocommit = True)
However, I got error message:
('HY000', '[HY000] [Microsoft][ODBC Driver 13 for SQL Server]SQL Server Network Interfaces: The Microsoft Online Services Sign-In Assistant encountered an error that might not occur if retried. Possible reasons include a transient network error. [x80048849]. (-2147186615) (SQLDriverConnect)')
Anyone has idea? My error came out when I tried to connect to azure. In the error message, it said retried may work, but I have tried several times, and I still saw this error. I see most of people have this issue when they run the query. Please feel free to leave your comment.

I have figured out the issue. Because it is connected to Azure, i dont need to include Trusted_Connection='yes', which is for windows authentication.

Related

How can I fix the error: 'an existing connection was forcibly closed'. (Office 365 REST Python client)

I recently created a solution to automate some copy-pasting of Excel files between SharePoint folders.
To establish the connection to SharePoint, I use the Office 365 REST Python client.
As an authentication method, I use clientcredentials (this allowed me to bypass TFA on the SharePoint).
I have verified that the ID and secret that I am using are still valid.
Until recently, the code was working like a charm.
Yesterday, however, I got the following error (and have been getting it ever since):
Requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
Weidly, sometimes I get the following error instead:
File "...\acs_token_provider.py", line
45, in get_app_only_access_token
self.error = e.response.text
AttributeError: 'NoneType' object has no attribute 'text'
I have encountered several posts mentioning the first error.
However, none of them were related to the package that I am using.
Below is a simplified example of my code which produces the same error:
from office365.runtime.auth.client_credential import ClientCredential
from office365.sharepoint.client_context import ClientContext
CLIENT_ID = "thecorrectclientid"
CLIENT_SECRET = "thecorrectclientsecret"
site_url = "https://{xxxx}.sharepoint.com/sites/{nameofthesite}"
ctx = ClientContext(site_url)
creds = ClientCredential(CLIENT_ID, CLIENT_SECRET)
ctx.with_credentials(creds)
web = ctx.web
ctx.load(web)
ctx.execute_query()
print("Web title: {0}".format(web.properties['Title']))
Does anyone have an idea what may be causing this and how I could possibly fix this?
Any help would be greatly appreciated!
UPDATE: It seems to be a problem related to my local machine.
I just cloned the repo on my other laptop and it runs smoothly.
I have also noticed the following error when opening files from SharePoint (which might be related):
the server you are trying to access is using an authentication protocol not supported by office sharepoint excel
I tried refreshing the Client Id and Client secret (to make sure I wasn't using expired credentials).
I have browsed the web for similar errors, but none of them gave me the answer for my specific situation.
I have double checked if anything changed in the URL of the site that I am trying to access.
I tried running it on another laptop and that worked for me. But the root cause is still a mystery.
No results...
UPDATE: I tried running it on another laptop and that worked for me. But the root cause is still a mystery.

'MSSQL' encountered unexpected exception of type 'InvalidOperationException' with HResult 'x80131509' while opening connection

When I am trying to load a query into a tabular dateset (from a devops docker image) I will get the following error:
raise DatasetValidationError(error_message + '\n' + str(e), e)
azureml.data.dataset_error_handling.DatasetValidationError: Cannot load any data from the datastore using the SQL query "<azureml.data.datapath.DataPath object at 0x>". Please make sure the datastore and query is correct.
Error Code: ScriptExecution.DatabaseConnection.Unexpected
Failed Step: 9ad57100-4870-49d2-a32f-1c9c15c244e0
Error Message: ScriptExecutionException was caused by DatabaseConnectionException.
DatabaseConnectionException was caused by UnexpectedException.
'MSSQL' encountered unexpected exception of type 'InvalidOperationException' with HResult 'x80131509' while opening connection.
Internal connection fatal error.
I believe that I have allowed the connection in firewall (I might not have done it quite right).
I don't get the error when I am running it from the notebook (on the compute instance).
Is the code that is running on the compute instance the exact same as the docker image? If so, it's likely that the firewall is causing connectivity issues. One way of checking this is to (be cautious) disable the firewall and see if the connectivity issue is gone.
If you're comfortable sharing the firewall/network configurations, that will also help troubleshoot this.

SSAS Data Pump - IsapiModule could not be found

The data pump was previously running on an server with IIS and SQL Server running on the same server. It was working fine. We've been provided a new SQL named instance and we're trying to re-setup the data pump to point to the new server. New SQL server is also new version, so we are using the new msmdpump from the new SQL installation. We've previously set this up on several client sites, so have followed the requirements with the data pump setup, but in this case I'm stuck with a "specified module could not be found" for the IsapiModule. I suspected that it might be an access issue to the msmdpump dll, but I've gone as far as to move the folder to a location with "full everyone access". I've set up tracing and the relevant details for the problem seems to be;
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName: IsapiModule
Notofocation: EXECUTE_REQUEST_HANNDLER
HttpStatus: 500
HttpReason: Internal Server Error
HttpSubStatus: 0
ErrorCode: The specified module could not be found. (0x8007007e)
I've tried everything I could find online, so any assistance or advice will be great.
Same error as the following IIS 8.0 Detailed 500.0 Internal Server Error - IsapiModule Not Found
Ok this was quite tough, had exactly the same issue but was able to resolve by installing this:
Which I found here:
https://www.microsoft.com/en-us/download/details.aspx?id=40784

ErrorLoadingExtensionAndDefinition error while creating host pool in azure

I am not able to create host pool in azure. I am getting the following error:
Session ID
2e53a5fd5e54499ab7dc3d6e9b4911d7
Resource ID
Not available
Extension
Microsoft_Azure_WVD
Content
HostpoolBlade
Error code
--
Error reason
ErrorLoadingExtensionAndDefinition
I would be grateful if anyone can help to resolve this issue.
I had the same error: ErrorLoadingExtensionAndDefinition when I tried creating the Azure Synapse Analytics (workspaces) on Safari browser. I used Chrome and it worked just fine. If you're using Edge, please check if it's in the latest version.

Error connecting to Redis on .net Core app hosted on Azure

We have a redis cache hosted on Azure and we use the following as a service in our .net core application:
services.AddSingleton<IConnectionMultiplexer>(provider =>
ConnectionMultiplexer.Connect(Configuration.GetConnectionString("RedisConnection"))
);
Our connection string is similar to the following:
ourserver.redis.cache.windows.net:6380,password=******=,ssl=True,abortConnect=False,syncTimeout=4000
in getting from cache we don't face problems but if we add to cache we sometimes get the following error:
"StackExchange.Redis.RedisConnectionException: It was not possible to
connect to the redis server(s); to create a disconnected multiplexer,
disable AbortOnConnectFail. ConnectTimeout"
I have read solutions like setting abortconnect to false and increasing the timeout but I have implemented it like the connection string above.
If you have suggestions or you think that we have a problem with the connection string kindly advise.
Update: we have implemented a solution to solve connectivity issue but now we get this:
StackExchange.Redis.RedisConnectionException: No connection is available to service this operation
What is your connectTimeout set to? Can you try increasing that to see if it helps?

Resources