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.
DataSource
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.