SQL+TOMCAT+JSP Environment Construction

Source: Internet
Author: User

JDBC: Communication interface function

 1.mysql driver (JDBC): The driver is placed in the project library or tomcat/lib, MySQL website jdbc includes the JDBC driver and API2.JDBC API: Database access interface 3.jsp and database access 4. Process Load driver (operation of which database (MySQL Oracle) class.forname (DRIVER);p ublicstaticfinalstring driver= "Org.gjt.mm.mysql.Driver";---> Create link (connect link to database, via URL) drivermanager.getconnection (url,username,username),----> Create action SQL statement   Statement interface, instantiated by the Createstatement () method of the Connection interface, Statement.executeupdate (SQL) to manipulate the database (-PreparedStatement interface  -is statement sub-interface, is a preprocessing operation, and directly using statement, is to prepare a SQL statement in the data table, but the specific content of this SQL statement is not set, but after the setting, that is, occupy this location waiting for user settings  -String sql= "insert INTO newtable (name,sex) VALUES (?,?)";  -pstatement=conn.preparestatement (SQL); Instantiation  -pstatement.setstring (1, name); -pstatement.setstring (2, Sex); -pstatement.executeupdate ();  -NOTE: It is not recommended to use statement to manipulate the database in development, but to use PreparedStatement because statement is a complete SQL statement  -processing Big Data Objects-- Must use PreparedStatement)  ---> Accept query Results-ResultSet interface-Accept the queried records and display the content, in development to limit the number of queries  -ResultSet rset= Statement.executequery (SQL); 

SQL+TOMCAT+JSP Environment Construction

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.