Home » Tag Archives: JDBC

Tag Archives: JDBC

JDBC – Emulating a sequence

Probably each of us encountered this problem at least once in the programmer’s life – how to emulate a database sequence? Below you may find my variation of this problem’s solution. Suppose that we have an interface defining the desired API for returning a sequence of integer numbers: 1 2 3 4 5 public interface Sequences {       int nextValue(String ...

Read More »

Java: Streaming a JDBC ResultSet as CSV

spring-interview-questions-answers

In my previous post, I showed how to convert a java.sql.ResultSet to JSON and stream it back to the caller. This post, is about streaming it in CSV format instead. Streaming allows you to transfer the data, little by little, without having to load it all into the server’s memory. For example, consider the following ResultSet: +---------+-----+ | Name | ...

Read More »

Fully working prototypes with Spring Boot and H2

spring-interview-questions-answers

We do use a lot of h2 with spring especially for unit tests. However instead of unit tests we might want to have a fully functional prototype with data to display. H2 is the perfect candidate for that, it works great with spring, it has good syntax compatibility with most databases out there and it also provides you with a ...

Read More »

Java: Streaming a JDBC ResultSet as JSON

This post shows how you can convert a java.sql.ResultSet to JSON and stream it back to the caller. This is useful if you want to send a large dataset from a JDBC DataSource to a web application in JSON format. Streaming allows you to transfer the data, little by little, without having to load it all into the server’s memory. ...

Read More »

Session Management using Spring Session with JDBC DataStore

spring-interview-questions-answers

In web applications, user session management is very crucial for managing user state. In this article, we are going to learn about what are the approaches we have been following to manage user sessions in a clustered environment and how we can use Spring Session to implement it in a much simpler and more scalable way. Typically in production environments, we will ...

Read More »