1. Bootique Integration with JDBC
|This is an incomplete 1.x version of the JDBC documentation. 2.x is more comprehensive.|
JDBC is a well-known standard Java API to access relational databases. Normally you would connect to a database via a connection pool represented by a
bootique-jdbc is a set of modules for configuring one or more DataSources in your app. It also provides advanced facilities for database testing and connection pool monitoring.
Out of the box Bootique supports two connection pool providers: Tomcat JDBC and HikariCP. Both are production-quality data sources, and you can choose either one. From the application perspective the difference is mostly in configuration and available metrics and health checks, as Bootique (and JDBC) gives you the API abstraction common to both.
Import one of these Bootique modules in your app, depending on your connection pool choice:
<!-- For Tomcat DataSource --> <dependency> <groupId>io.bootique.jdbc</groupId> <artifactId>bootique-jdbc-tomcat</artifactId> </dependency>
<!-- For HikariCP --> <dependency> <groupId>io.bootique.jdbc</groupId> <artifactId>bootique-jdbc-hikaricp</artifactId> </dependency>
Alternatively you may include an "instrumented" version of each module, that will enable a number of metrics for your running app.