Create JSP operations to improve database access efficiency

Source: Internet
Author: User
Java Server Pages (JSP), which promotes rapid program development on the Server side, makes it a popular tool. Although the dull side still exists, JSP can provide a lot of things for Web programmers, especially with database input and output operations and data processing, no matter how many disadvantages it contains.
Using JSP for database access does not require much guidance. The question is how to make developers more attractive to access the database of Web programs than to access the database of traditional local OLAP systems, and make them realize that, clean and brief data access methods are critical. At this point, JSP can be well solved.
What can you do?
If you are writing a Web program with high data volume and data density, what requirements should your database access meet? If you are using JSP, you must process a large amount of data on the server. The program may need a large amount of data, many users, or the combination of the two. You may also consider performance optimization, testability, the impact of multiple queries for each user, and query complexity, and high-level type conversion when a single session processes a large amount of data.
This includes large-scale processing. However, JSP can help you handle it well because it is compatible with Java Database Connectivity API (JDBC. You can include JDBC in JSP code, and JDBC can pass statements to execute commands similar to databases, as long as you can correctly use the JDBC driver.
Start
Here is a general and abstract JSP program execution system. The preferred JSP design mode is model-View-Controller (MVCModel-View-Controller), which is a variant of the traditional three-tier system to better adapt to server programs. In the MVC design mode of JSP, Model refers to the logic and data of the program. View is View, and Controller is request processing.
When you design a JSP program, it is the best process to create a page in step 1 between the client and the server. For example, in a typical program, each specific step in data exchange has a page: a data entry page, a verification request page, and a database response page, and the subpages of these pages (a page for changing records, a page for deleting records, and so on ).
You can embed JDBC into each page to complete the requested database operations. However, this operation can also take a big risk, because the JSP and JDBC are mixed with the entire program-JDBC is based on SQL. That is, SQL is encapsulated in JDBC, and JDBC is also encapsulated in JSP -- this is enough to make you dizzy. If you choose this method, you will get the functions you want, but be careful when you make sure that the relationship between your program logic and the database access code is very clear.
Embedded JDBC
JDBC APIs do not communicate with databases directly. The driver completes the actual connection, you can download these drivers on the seller's Web site. In addition, there are four JDBC driver types. If you decide to use JDBC, you need to select the type that best suits your needs. You will use a DriverManager class to process driver-based connections.
Related Article

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.