0% found this document useful (0 votes)
2 views19 pages

Unit 4 Java

The document discusses JDBC Data Access with Spring, highlighting the management of JDBC connections and the use of JdbcTemplate for data access operations. It outlines the challenges associated with the JDBC API, such as excessive boilerplate code and the need for exception handling. The document emphasizes how Spring Jdbc simplifies database interactions by reducing code complexity and improving efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views19 pages

Unit 4 Java

The document discusses JDBC Data Access with Spring, highlighting the management of JDBC connections and the use of JdbcTemplate for data access operations. It outlines the challenges associated with the JDBC API, such as excessive boilerplate code and the need for exception handling. The document emphasizes how Spring Jdbc simplifies database interactions by reducing code complexity and improving efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

JDBC Data Access with Spring

Topics to be Covered

Managing JDBC Connection, Configuring Data Source to obtain JDBC

Connection, Data Access operations with JdbcTemplate and Spring, RDBMS

operation classes , Modelling JDBC Operations as Java Objects


Spring JdbcTemplate Tutorial

Spring Jdbc is a powerful mechanism to connect to the database and execute


SQL queries. It internally uses JDBC API, but eliminates a lot of problems of
JDBC API.

Spring
Java Program Database
JDBC
Module

JdbcTemplate
JDBC Concept

JDBC is an API to perform operation with database

Java Program JDBC


API Database
Problems of JDBC API
● We need to write a lot of code before and after executing the query, such

as creating connection, statement, closing resultset, connection etc.

● We need to perform exception handling code on the database logic.

● Repetition of all these codes from one to another database logic is a time

consuming task.
Problems of JDBC API

● We need to write a lot of code before and after executing the query, such

as creating connection, statement, closing resultset, connection etc.

○ Connection open

○ Statement

○ Execute

○ Connection close

All these steps need to be done repeatedly


Problems of JDBC API

● We need to perform exception handling code on the database logic.

● SQL EXCEPTION

○ Need to write the code in try catch


Problems of JDBC API

● Repetition of all these codes from one to another database logic is a time

consuming task.

● Same code needs to be re written in each java code where jdbc is used
JDBC = Java DataBase Connectivity

Managing JDBC Connection


Configuring Data Source to obtain JDBC Connection
Configuring Data Source to obtain JDBC Connection
Data Access operations with JdbcTemplate and Spring

You might also like