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

Need to understand undocumented functions #144

Open
steowens opened this issue Feb 19, 2020 · 1 comment
Open

Need to understand undocumented functions #144

steowens opened this issue Feb 19, 2020 · 1 comment

Comments

@steowens
Copy link

I am attempting to migrate an app which uses c3po over to leveraging AWS IAM credentials:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.Java.html

Apparently AWS issues a new access token every 15 minutes, and this is used as the password for the jdbc credentials. We use the ComboPooledDataSource which extends AbstractComboPooledDataSource which extends AbstractPoolBackedDataSource which extends PoolBackedDataSourceBase which extends IdentityTokenResolvable

ComboPooledDataSource uses WrapperConnectionPoolDataSource which wraps DriverManagerDataSource.

Anyway there are a whole bunch of undocumented public functions and methods on this heirarchy, and what I am trying to figure out as I weed my way through this code is what do I need to do to fix it so that we can have a ComboPooledDataSource connect to RDS hosts in multiple regions using the host list stragegy on the JDBC url, and have it execute failover the way it does very well with ordinary static credentials, subject to the constraint that if using IAM credentials instead, the password on each host is different and is subject to change every 15 minutes?

@swaldman
Copy link
Owner

One way to address this would be to create your own DataSource implementation, reorganizing the example code that you link. You'd want to just implement the getConnection() method, maybe throw or delegate to that if getConnection(String user, String password) ever gets called, quick stubbish implementations of all the rest. getConnection() would do authentication as shown.

Then wrap your custom DataSource into a PooledDataSource. See https://www.mchange.com/projects/c3p0/#using_datasources_factory

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