Giter VIP home page Giter VIP logo

Comments (3)

willtong1234 avatar willtong1234 commented on August 17, 2024

First off, you should never hard-code the AWS access key and AWS secret key. See https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html for AWS access key best practices. If you are running on an EC2 instance or in a Lambda, please take advantage of the instance role (for EC2) or the execution role (for Lambda). For everywhere else, follow the best practices regarding credentials files/environment variables.

Now back to your original question. The short answer is yes, this is possible. You would just deregister the existing driver and register the new driver that is instantiated with your own SDK client. For example:

        // Deregister the driver first
        Enumeration<Driver> drivers = DriverManager.getDrivers();
        if (drivers != null) {
            while (drivers.hasMoreElements()) {
                Driver driver = drivers.nextElement();
                if (driver.getClass() == AWSSecretsManagerPostgreSQLDriver.class) {
                    DriverManager.deregisterDriver(driver);
                }
            }
        }

        // Register new driver
        AWSSecretsManager client = AWSSecretsManagerClientBuilder.standard()
                                       .withRegion(Regions.US_EAST_2)
                                       .build();
        DriverManager.registerDriver(new AWSSecretsManagerPostgreSQLDriver(client));

Hope that answers your question.

from aws-secretsmanager-jdbc.

willtong1234 avatar willtong1234 commented on August 17, 2024

It has been 3 weeks so I'm assuming your question was answered. I'm going to resolve this issue.

from aws-secretsmanager-jdbc.

r-jindal avatar r-jindal commented on August 17, 2024

Is this the only solution for the work-around ?
The solution provided is 2 years back, Is there any update on this ?
AWSSecretsManagerPostgreSQLDriver is a final class, so I cant extend that.
But there are constructors which take parameters like AWSSecretsManager client. I need to know the way, how to use them.

from aws-secretsmanager-jdbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.