20165301 2017-2018-2 "Java Programming" Seventh Week study summary

Source: Internet
Author: User

20165301 2017-2018-2 "Java Program design" Seventh week study summary textbook Learning content Summary 11th: JDBC and MySQL Database
  • MySQL Database management system

  • Start the MySQL database server
  • A command-line window that directly shuts down MySQL does not shut down the MySQL database server and shuts down the MySQL Database manager using the Task manager provided by the operating system.
  • Modify any user passwordmysqladmin -u root -p password
  • MySQL Client management tool
  • Jdbc
  • JDBC is an API specifically designed to manipulate the database
  • JDBC operation of different databases is only a difference in connection mode.
  • Query operations
  • Sending SQL query statements to the database
    try{ Statement sql=con.creatStatement(); } cath(SQLException e ){}
  • Working with query resultsResultSet rs = sql.executeQuery("SELECT*FROM students");
  • Close connectioncon.close()
  • Sequential query
  • Use the ResultSet object to see only one data row at a time, using the next () method to move to the next data row, and the initial query location is the cursor position.
  • Control cursors
  • Get Statement ObjectStatement stmt = con.createStatement(int type,int concurrency)
  • Condition and sort Query
  • where child statement
    • General format:select 字段 from 表名 where 条件
    • Sort: Sort records with an order by child statement
      selete * from mess order by height selete * from mess where name like ‘%林‘ order by name
  • Update, add, and delete operations
    • Statement Object Invocation Method

      public int executeUpdate(String sqlStatement);
    • Update:update 表 set 字段 = 新值 where <条件子句>
    • Add to:insert into 表(字段列表) values (对应的具体的记录)
    • Delete

      delete from 表名 where <条件子句>
  • Using Preprocessing statements
    • Advantages of preprocessing statements: reducing the burden on the database and increasing the speed of accessing the database
    • Use wildcards: You must call the appropriate method to set the wildcard character before the SQL object executes. "Represents the specific value
  • General Survey
    • The ResultSet object calls the GetMetaData () method to return a ResultSetMetaData object, and then calls the getColumnCount () method to return the number of columns in the result set RS, calling other methods to implement the corresponding function.
  • Transaction
    • Transactions and processing: the application guarantees that the SQL statements in the transaction are either all executed or not executed.
    • Transaction process steps
    • Turn off autocommit mode with the Setautocommit (Booean B) method
    • Handling transactions with the Commit method
    • Processing a transaction failure with the rollback () method
  • Connecting to a SQL Server database
  • Connecting the Derby Database

Code Hosting
    • There is a problem with git, the code is not successfully uploaded and is being debugged.

(run result of statistics.sh script)

Learning progress Bar
lines of code (new/cumulative) Blog Volume (Add/accumulate) Learning Time (new/cumulative) Important Growth
Goal 5000 rows 30 Articles 400 hours
First week 11/11 1/1 4/4
Second week 286/297 2/3 6/10
Third week 722/1004 1/4 10/20
Week Four 421/1425 1/5 10/30
Week Five 829/2283 1/6 10/40
Week Six 943/3326 2/8 10/50
Seventh Week 497/3823 1/9 10/60

20165301 2017-2018-2 "Java Programming" Seventh 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.