Home » JDBC

Tag Archives: JDBC

10 JdbcTemplate Examples in Spring Framework

spring-interview-questions-answers

Hello guys, If you have been using the Spring framework then you may know that the JdbcTempalte is one of the most useful classes of Spring framework. The JdbcTempalte class provides lots of convenient methods for performing database-related tasks that take the pain away from using the JDBC API. If you have worked in any real-life JAva project which connects to Database ...

Read More »

Tomcat JDBC Pool – Connection Leak – Catch the Culprit

Database connection leaks are something that can stay hidden unless paid specific attention and would come to the surface at the most critical stages at a peak time of the system. We would manually check if all the open connections have been closed properly. Then we have various code quality plugins that would scan and check for that. Still when ...

Read More »

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 »