microsoft / sql-spark-connector

Apache Spark Connector for SQL Server and Azure SQL
Apache License 2.0
273 stars 116 forks source link

Auto refreshing Access token #220

Closed amelia901 closed 1 year ago

amelia901 commented 1 year ago

Hello,

The Access token has a short expiry of 1 hour from generation and this may cause issues with the long-running applications (as a writing process that takes more than one hour). Is there a way to add a auto-refreshing for the access token.

When the writing process takes more than one hour, it craches and gives this error :

Job aborted due to stage failure.
Caused by: SQLServerException: Login failed for user '<token-identified principal>'. Token is expired. ClientConnectionId:22317c52-0202-44af-89ee-9e3f94e17f6f
luxu1-ms commented 1 year ago

Close this issue as access token is not related with the connector repo.

amelia901 commented 1 year ago

hello @luxu1-ms This strange, the access token is automatically refreshed by MSAL4J lib. But this connector when it start writing data will not check the cache and throw an error after one hour. I think the issue is related to this lib...