JdbcProgramming Steps:
1. Load Database Driver
2. Create and get database links
3. Creating a JDBC Statement Object
4. Set the SQL statement
5. Set parameters in SQL statement ( using preparedstatement)
6. Execute SQL via statement and get results
7. Parse the results of SQL execution
8. Releasing Resources (ResultSet,preparedstatement,connection)
JdbcThe questions are summarized as follows:
1, the database link creation, the release frequently causes the system resources to waste thus affects the system performance, if uses the database link pool solves this problem.
2, SQL statements in code hard-coded, resulting in code is not easy to maintain, the actual application of SQL changes may be large,SQL changes need to change the Java Code.
3, using the PreparedStatement to the possession of the symbol parameters are hard-coded, because the where condition of the SQL statement is not necessarily, may be more or less, modify the SQL also to modify the code, the system is not easy to maintain.
There is hard coding for result set parsing (query column name),SQL changes cause parsing code change, system is not easy to maintain, if it is convenient to encapsulate database records into Pojo object parsing.
JDBC Programming Step-up, problem summary (i.)