Spring Data -Spring JDBC
The Spring Data access logic revolves around Template patterns and Support classes
Drawbacks of JDBC
-
In JDBC all the exceptions are checked, so we must use try, catch blocks in the code.
-
if we open the connection with database, we only responsible to close that connection.
-
JDBC error messages are Database related error messages, not every one may understand.
Spring JdbcTemplate eliminates all the above mentioned problems of JDBC API. It provides you methods to write the queries directly, so it saves a lot of work and time.
We have following templates to work with JDBC related things in Spring.
-
JdbcTemplate
-
NamedParameterJdbcTemplate
-
SimpleJdbcTemplate
PREVIOUSSpring Data
NEXT-JdbcTemplate