Spring — Difference between JDBC and Spring JDBC | Code Factory

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store