20145309 Haopeng Li Nineth Week study summary

Source: Internet
Author: User

Summary of the learning contents of the textbook 16th Chapter integration Database

I. Getting Started with JDBC

(i) Introduction to JDBC

When the manufacturer operates the JDBC driver, the driver can be divided into 4 types depending on how it operates

    1. JDBC-ODBC Bridge Driver

      • Translating JDBC calls into calls to ODBC drivers, operating the database by the ODBC driver
      • Limited function, insufficient elasticity
    2. Native API Driver

      • Invoking the native link library provided by the database in its native way, the JDBC method call is converted to the associated API call in the native link library
      • Speed Advantage
    3. Jdbc-net Driver

      • To convert a JDBC method call to a specific network protocol call, and to perform a protocol operation remotely with a database-specific mediation server or component
      • Slower speed for architectural resiliency
    4. Native Protocol Driver

      • Convert a JDBC call to a database-specific network protocol to communicate with the database
      • Can be used across platforms without the need for schema resiliency

(ii) connection to the database

    1. Registering driver objects: calling the Registerdriver () method
    2. Get connection Action object: getconnection ()
    3. Close Connection Action object: Close () (isClosed () method to test if the connection to the database is closed)

      Example Connectiondemo

(iii) Use of statement, ResultSet

    1. To execute SQL, you must get the Java.sql.Statement action object
    2. Using createstatement () to establish statement objects
    3. ExecuteQuery (): SQL for querying databases such as SELECT, returning Java.sql.ResultSet objects
    4. ExecuteQuery (): Return int result

      Example Messagedao

      Example Message

      Example Messagedaodemo

(iv) Use of PreparedStatement, CallableStatement

    1. If some of the operations are just some of the arguments in the SQL statement will be different, the rest is the same, you can use Java.sql.PreparedStatement
    2. Use the PreparedStatement () method to build a precompiled SQL statement, with parameter changes partially used "? ”
    3. Use the executeupdate () and ExecuteQuery () methods to make SQL execution effective
    4. After execution, call Clearparameters () to clear the setup parameters

      Example Messagedao

17th Chapter

Using reflection Java really requires a class to load the corresponding. class document, not load all classes when the program starts.

Use the GetClass () method of object, or the. class constant to get the class object for each object, and if it is a base type, you can also get the class object by using the corresponding package class plus. Type. For example, Integer.type can get a class object representing int.

Use the ' Class.forName () method to implement the dynamic load class.

The Java.lang.reflect.Method instance is the representative object of the method, and you can use the Invoke () method to invoke the specified method dynamically.

Understanding the ClassLoader (ClassLoader)

is to read the binary data in the. class file into memory, place it in the method area of the run-time data, and then create the Java.lang.Class object of the class in the heap to encapsulate the class's objects in the method area class.

The JVM divides the class loading process into three steps: Mount (load), link, and Initialize (Initialize) links in a three-step way.

18th Chapter

Custom generics

When you define a generic, you must be a subclass of a class when you specify the actual type of T with the extends qualification. When you define a generic, you must be a subclass of a class when you specify the actual type of T with the extends qualification.

Covariance (covariance): B is a subclass of a, Node B can be considered a node A, which is called node has covariance.

wildcard character "? "The type with extends limit T, can only be specified by the name of the T declaration to object, or the name of the T declaration is specified as null.

Problems in teaching materials learning and the solving process

Learning process is only some of the nouns are not clear, checked on the good, not one by one cases, 88 chapters at the beginning of the semester the teacher crossed off, so just looked over

20145309 Haopeng Li Nineth Week study summary

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.