JDBC with Spring

In the earlier section, we did not include any Spring-related functionality, and we implemented a Java class that had DAO implementation, which connected to a database to fetch a particular record using JDBC. Now in this section, we will look at some of the features of the Spring Framework that make our job easier by eliminating the boilerplate code. Here, we will look into the connection support provided by Spring that makes it easy to handle the connections.


The DriverManagerDataSource class is used for configuring the DataSource for application, which is defined in the configuration file, that is, Spring.xml. So, first of all, we need to add the Spring JAR that will have the DriverManagerDataSource class to our project. ...

Get Spring: Developing Java Applications for the Enterprise now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.