Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hikari + Snowflake + Oauth with token refresh #2183

Open
rsdetoni opened this issue Mar 1, 2024 · 1 comment
Open

Hikari + Snowflake + Oauth with token refresh #2183

rsdetoni opened this issue Mar 1, 2024 · 1 comment

Comments

@rsdetoni
Copy link

rsdetoni commented Mar 1, 2024

Hi, Team Hikari =)

Guys I am having difficult to implement Hikari with snowflake, the problem is that I need to refresh the token and for that I use this suggestion:

https://blog.jdriven.com/2021/06/configure-hikari-connection-pool-when-using-rds-iam/

I just change a little bit because I am using azure, at the end i need to pass this properties:

    ctx = snowflake.connector.connect(
       user="<username>",
       host="<hostname>",
       account="<account_identifier>",
       authenticator="oauth",
       token="<external_oauth_access_token>",
       warehouse="test_warehouse",
       database="test_db",
       schema="test_schema"
    )

The first time worked great, but when the first token expire I am facing jdbc connection failed. My code is showing the refresh token correctly when max-lifetime is ended, and the getToken is called for getPassword.

My code is based on spring and I am using this annotations for generate only one Hikari by application, because I think Hikari don't support multithread with multi-instances, because of that I used the singleton annotation on a @configuration:

     @Bean(name = "DataSource")
     @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
     //Create datadource with configuration

Could you explain or give an example how to refresh token using this pool of connections. I am feeling that the old connections are stuck and we are not using the new ones

@urosjarc
Copy link

urosjarc commented Mar 2, 2024

I'm also interested on how good and stable is snowflake support, if any?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants