Just updated a library which makes life much easier when speaking about databases…
When streams were introduced in java I got myself thinking of how I can leverage it with databases. It is “pretty common” task to write SQL queries and process the results within Java. And the more I was ought to deal with prepared statements, result sets, all those SQLExceptions etc., the more I was disappointed. Searching the WEB for solutions where I wanted to find two worlds collided conveniently – I found no suitable one! Of course there are many libraries that afford some, but neither of them suited me. I wanted something else. Therefore I decided to write one myself for myself.
My goals…
…were based on my background experience:
No prepared boilerplate and SQLExceptions
Executing arbitrary scripts
Minimal configuration
“Real” streams (lazily data fetching)
Raw SQL
Database is just a method invocation
and some others – don’t remember them all 🙂
So after some time I ended up with this:
A brief
1 – Maven:
<groupId>com.github.buckelieg</groupId>
<artifactId>jdbc-fn</artifactId>
<version>1.0</version>
</dependency>
2 – Setup:
.withMaxConnections(10)
.build(() -> DriverManager.getConnection(“vendor-specific-string”));
3 – Select:
Happy to share: jdbc-fn project.