Spring — Difference between JDBC and Spring JDBC | Code Factory
Jan 29, 2021
Donate : Link
WordPress Blog : Link
Applications… : Link
Spring Tutorial Index Page: Link
Difference between JDBC and Spring JDBC
JDBC
- All the exceptions are compiletime exception (CE)
- CE is java.sql.SQLException (It will print database exceptions).
- User must need to close connection.
- Jdbc PreparedStatement is type safe.
- For select operation always it will return ResultSet.
Spring JDBC
- All the exceptions are runtime exception (RE).
- RE is DataAccessException (It will print database exceptions). It is in spring-dao.jar file.
- User no need to close connection.
- All JdbcTemplate methods are type safe using Types class.
- Generic select methods for all type of select operations.