Data Access with JDBC

The value provided by the Spring Framework JDBC abstraction is perhaps best shown by the sequence of actions outlined in the following table below. The table shows which actions Spring takes care of and which actions are your responsibility.spring-doc.cn

Table 1. Spring JDBC - who does what?
Action Spring You

Define connection parameters.spring-doc.cn

Xspring-doc.cn

Open the connection.spring-doc.cn

Xspring-doc.cn

Specify the SQL statement.spring-doc.cn

Xspring-doc.cn

Declare parameters and provide parameter valuesspring-doc.cn

Xspring-doc.cn

Prepare and run the statement.spring-doc.cn

Xspring-doc.cn

Set up the loop to iterate through the results (if any).spring-doc.cn

Xspring-doc.cn

Do the work for each iteration.spring-doc.cn

Xspring-doc.cn

Process any exception.spring-doc.cn

Xspring-doc.cn

Handle transactions.spring-doc.cn

Xspring-doc.cn

Close the connection, the statement, and the resultset.spring-doc.cn

Xspring-doc.cn

The Spring Framework takes care of all the low-level details that can make JDBC such a tedious API.spring-doc.cn