This repository was archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
DataSource
Tiago Simão edited this page Sep 6, 2016
·
1 revision
org.irenical.drowsy.datasource.DrowsyDataSource is a DataSource implementation with built-in dynamic configuration, allowing you to change any property at runtime. It's built upon HikariCP, Flyway and Jindy.
DrowsyDataSource is in itself a Lifecycle and can be used separately from Drowsy.
Lifecycle
DrowsyDataSource ds = new DrowsyDataSource();
ds.start();
... your code ...
ds.stop();Retrieving a connection
Connection got = ds.getConnection();
... your code ...
got.close();Keep in mind that DrowsyDataSource does not handle resource release. If you're using this module alone, ensure you close your Connections, Statements, ResultSets or any other JDBC resource you create.
DataSource configuration is as in HikariCP, prefixed with jdbc. Plus two Flyway specific configurations.
jdbc.url=jdbc:postgresql://localhost:5432/MyDB
jdbc.username=me
jdbc.password=hunter2
...
# Whether or not to use Flyway, defaults to false
jdbc.flyway.bypass=false
#If set and Flyway is active, only updates greater that this will be applied, defaults to null
jdbc.flyway.baselineVersion=3