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

Creating a connection pool with custom connector #929

Open
SebastienMelki opened this issue Jun 10, 2024 · 1 comment
Open

Creating a connection pool with custom connector #929

SebastienMelki opened this issue Jun 10, 2024 · 1 comment

Comments

@SebastienMelki
Copy link

Hello,

We are using IAM Authentication in order to connect to an RDS mysql cluster. We are encountering a problem: the credentials that the connection pool is using have to be modified every 15 minutes, because AWS only provide tokens with a TTL of 15 minutes.

A solution to use IAM with connection pooling and the mysql driver is described here go-sql-driver/mysql#1354 but it involves using a custom connector. It seems to be using sql.OpenDB() instead of sql.Open().

Is there a way to use a custom connector with sqlx? I couldn't find a way to plug it in.

If not, is there a recommended way to use sqlx mysql connection pools with aws IAM?

Thank you

@mpalmer
Copy link

mpalmer commented Oct 26, 2024

By the looks of it, you can (probably) get what you need by creating your driver.Connector, passing that to sql.OpenDB(), and then passing the resulting sql.DB to sqlx.NewDB().

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