Skip to content

Instantly share code, notes, and snippets.

View Brend-Smits's full-sized avatar
🎯
Focusing

Brend Smits Brend-Smits

🎯
Focusing
View GitHub Profile
@A248
A248 / Using JDBC.md
Last active October 31, 2020 18:12

This is a basic tutorial intended to showcase best practices for connecting to a SQL database. It will not tell you everything, but it is a good start.

Another assumption is that you will be using HikariCP. A connection pooling library will handle recreating Connections for you in a proper manner, while respecting network timeouts and max lifetime settings.

Setup the HikariDataSource

First make a class to wrap your HikariDataSource: