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

Allow data source properties to be set directly in HikariConfig #5

Closed
jiri-pejchal opened this issue Dec 5, 2013 · 2 comments
Closed

Comments

@jiri-pejchal
Copy link

Currently there are two ways of configuring data source properties:

  • method addDataSourceProperty(String propertyName, Object value)
  • constructor HikariConfig(String propertyFileName)

I'm configuring HikariCP with spring xml configuration and I need to set datasource properties (url, user, password).

I can't call the method addDataSourceProperty from the xml configuration and I would need a real file for the constructor. Could you add possibility to set Properties directly, e.g. method

setDriverProperties(Properties properties)

or constructor

HikariConfig(Properties properties)
@brettwooldridge
Copy link
Owner

There is a getDataSourceProperties() method, which can be useful in an XML-based configuration to get properties, which can then be set, but it appears that Spring does not have this capability (Jetty, for example does). I'll add a setDataSourceProperties() method.

brettwooldridge added a commit that referenced this issue Dec 5, 2013
…ing for SQL to be executed on

new connections.
@brettwooldridge
Copy link
Owner

Code is available on dev branch now. Build is publishing and version 1.1.9 will appear in the Maven Central Repository in several hours.

brettwooldridge added a commit that referenced this issue Dec 5, 2013
* dev:
  Add code to execute connection initialization SQL requested by Jiri Pejchal.
  Fixes #5 add setDataSourceProperties() method.  Additionally, add setting for SQL to be executed on new connections.
  Update class path for new core/agent structure.  Should probably make this dynamic and maybe based on the .m2 repository instead of the local libraries.
  Simplify timeout code path, set auto-commit’ness upon every getConnection() in case the user changed it and returned a “dirty” connection to the pool.
  Demote warn log to info.
  Fix javadoc.
  Minor tweak to the pool fill algorithm to avoid unnecessarily calling additional getters in the ONLY_IF_EMPTY pool fill case.
brettwooldridge referenced this issue in swaldman/HikariCP Dec 13, 2013
…. Modified props-file reading constructor to use try-with-resources to ensure prompt file close.
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

2 participants