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

Add convenient alternative to set read-only url (on the main DataSourceConfig) #2001

Closed
rbygrave opened this issue Apr 30, 2020 · 0 comments
Closed
Assignees
Milestone

Comments

@rbygrave
Copy link
Member

For example:

        DatabaseConfig config = new DatabaseConfig();
        ...
        
        final DataSourceConfig dsConfig = config.getDataSourceConfig();
        dsConfig.setUrl("jdbc:...");
        dsConfig.setUsername("...");
        dsConfig.setPassword("...");
        dsConfig.setDriver("...");
        dsConfig.addProperty("useSSL", false);

        // set a url for the read-only DataSource
        // ... the username, password etc are copied from the "main" DataSourceConfig
        dsConfig.setReadOnlyUrl("jdbc:...");

       return DatabaseFactory.create(config)

So effectively we only need to additionally set dataSourceConfig.setReadOnlyUrl("jdbc:..."); on the 'main' DataSourceConfig.

This is an alternative to either:

// set a full read-only DataSource
config.setReadOnlyDataSource(...)

// set a full read-only DataSourceConfig
config.setReadOnlyDataSourceConfig(...)

@rbygrave rbygrave added this to the 12.3.1 milestone Apr 30, 2020
@rbygrave rbygrave self-assigned this Apr 30, 2020
rbygrave added a commit that referenced this issue Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant