JDBC Programming Step-up, problem summary (i.)

Source: Internet
Author: User

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.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.