It contains interfaces, exceptions, mysql, JDBC
1 , the interface can not be instantiated interface may be inherited interface implementation class have multiple interfaces can not have the private members themselves are abstract, wherein the interface is a collection of methods, but the method does not implement all of the methods are abstract interface Interface You can not define variables, constants can only declare static methods in an interface method body is not an interface can inherit multiple interfaces: interface3 Extends interface0, Interface1, abstract class single inheritance, interfaces, multiple inheritance 2 , SQL 1 ) set the table MySQL default character set keywords are: 2 ) connecting the inner join MySQL unique index: uNIQUE . 3 ) data type: type numeric, date and time types (DATETIME, dATE, TIMESTAMP, tIME, and YEAR) string type (CHAR, VARCHAR, BINARY, VARBINARY , BLOB, TEXT, ENUM and the sET) . 4 ) to view the character sets available in the system command: show character set to modify the database command level is: ALTER character database EDU sET UTF -8 . 5 ) storage engine: InnoDB engine support foreign key constraints, support affairs. MyISAM does not support transactions do not support foreign key constraints 6) Port: the port number of the client and server; the MySQL default port is 3306 the character_set_server: default internal operation of the character set, the server the default character set character_set_client: character set client data sources used character_set_connection: connection layer characters character_set_results: Results character set character_set_database: currently selected default character set of the database character_set_system: system metadata (field names, etc.) character sets 7 three elements) data model: data structure, data manipulation, data constraints. 8 ) circulation statement MySQL to achieve the while 9 ) DDL: data definition language, a language for defining and managing all objects of SQL database; the CREATE --- creating tables; ALTER --- to modify the table; DROP --- delete table DML: data manipulation language, SQL data processing operations referred to as data manipulation language; the iNSERT inserted data ---; --- the dELETE to delete data; --- modify the UPDATE data; --- the SELECT query data DCL : data control language, used to grant access to the database or recovery of a privilege, and control the effects of time and manipulate database transaction occurs, the implementation of monitoring databases; gRANT --- authorization; rOLLBACK --- rollback; COMMIT-- -Filed 10) prohibits automatic submission: set autocommit = 0; set autocommit = 1 is turned on automatically filed 11) under the default mode, is MYSQL Based autocommit mode, all database updates will immediately submit, so by default, mysql is It does not support transactions. If your MYSQL table type is to use InnoDB Tables or BDB tables, then your MYSQL can use transaction processing, using the SET AUTOCOMMIT = 0 can make MYSQL allow non-autocommit mode, in non-autocommit mode, you must use COMMIT to submit your changes, or use rOLLBACK to roll back your changes. TRANSACTION the START; the SELECT by @A: = the SUM (the salary) the WHERE type = the FROM table1. 1 ; the UPDATE Table2 summmary the SET = the WHERE type = A @. 1 ; a COMMIT; 12 is ) transaction management (ACID): atomicity, consistency, isolation, persistence 13 ) database transaction isolation level there are four kinds, from low to high, respectively read uncommitted (see uncommitted data), data read committed (read submitted data will be inconsistent), Repeatable read (the default isolation levels, can be read repeatedly), the Serializable (not writable read). View the current session isolation level: select @@ tx_isolation; Display the current isolation level: select @@ global.tx_isolation; set the current session isolation level: set session transaction isolatin level repeatable read ; set the system current isolation level: set global transaction isolation level repeatable read ; command line, begin a transaction when: set autocommit = OFF or transaction start 14 step) transaction: transaction start (sTART tRANSACTION), execute, commit or rollback 15 ) create a common index CREATE iNDEX index_name ON table_name (col_name) ; creating a unique index CREATE uNIQUE iNDEX index_name ON table_name (col_name ); create a common composite index cREATE iNDEX index_name ON table_name (col_name_1, col_name_2); create a unique composite index the cREATE uNIQUE iNDEX index_name ON table_name (col_name_1, col_name_2); 16 ) to delete the table of contents: truncate table table name; delete the table structure: drop table table; 17) to back up all the database: mysqldump -u root -p --all -databases> dbbak_all.sql mysqldump [options]--all-databases> / backup path / filename to export one or more libraries: mysqldump [options] --databases library name library name [1 2]> ...... export specified portions of the library table: mysql [options] library name [table 1] [2] table. . > ...... using the tar command database installation directory data directory directly packaged 18) for SQL backup script mysqldump derived data can be restored by command mysql: mysql -u username -p password [library] </ backup path / backup file name 19 ) the first paradigm goal is to ensure that each column of the atomicity 20 ) Visio will automatically help you add physical foreign keys. Specific operation is: first add two associated entities, then the two entities Entity "relationship" connected (drag period "relationship" is connected to the line to be linked, i.e., physical block red two entities a connection is established. If the two entities have the same name columns, foreign keys are automatically generated. If it does not generate, click where "relationship" below the line is set, you can set two associated entities associated with the selected line, and then specify a .-one relationship, or so-many relationship, the connector automatically generate foreign keys. rectangle: indicates the entity, the entity name entered; diamond: indicates contact, contact name entered; oval boxes: indicates the attributes of the entity or contact 21 ) comprises the step of collecting information database design, identify an entity, identifying relationships between entities, relationships between the entities attributes identifying 22 ) has three relational mapping database one, one-to-many 23) paging query "SELECT * FROM smbms_commodity limit 0,5" = "SELECT * FROM smbms_commodity limit 5"; limit record index, number of records. Index of default is zero, limit 5, and limit 0,5 equivalent 24- ) the FIND found; SELECT query; ALTER modification; DESC; modify table structure delete one, delete the table field: alter table table name drop column column name lookup table structure statement is desc table name; display table structure of the data table syntax: describe table name to display a list of databases: show table display records in the table: the SELECT * from table to delete a database that already exists in the table: DROP tABLE table name or Drop table IF EXISTS table modify the table column names: alter table table name change column column name of the new column name data type [properties] delete table records: dELETE [fROM] table [the WHERE <deletion condition> ] See column show columns from the table table; see all the tables show tables; view the database show databases is not empty: the SELECT *FROM table WHERE field IS NOT NULL authorized users to access the database tables: grant on ... to allow a user to obtain permission to 25 ) the AVG () returns the average of a field; the number of rows COUNT () Returns a field; MAX () Returns a maximum field; the SUM () and return a field; summing with the accumulated sum (), the number of lines required by the integrated count (). 26) Mysql the constraint types: primary key (primary key), a default value ( default ), the sole (unique), the foreign key (foreign key) and non-empty (Not null ) 27) ceil (): rounded up floor ( ): rounded down RAND (): 0- generates a random number between 1 and does not include a ceiling (): rounding 28 ) and bETWEEN values greater than or equal to a value less than or equal to 1 and value 2 29 ) string lowercase to uppercase upper (), lower () to lowercase 30 ) CURDATE: Gets the current date (date) CURTIME: get the current time (minutes and seconds) NOW: get the current date and time (year, month, day, hour, minute) the DATEDIFF: obtaining a time difference between two dates 31 ) is connected into the link, connecting left outer, right outer connection (iNNER JOIN, lEFT JOIN, RIGHT JOIN); the link: taking an intersection of the two tables show only meet the connection conditions record; left outer: all records right table of records that meet the left table join condition; right outer join: all records left table right table of records that meet the connection conditions. 32) In subqueries When keywords can be matched because a value equal sign, equals sign may be used so that a subquery only return a single result 33 ) allows a query subqueries nested within another query them. 3 , the abnormality . 1 ) is mainly the Java exception handling mechanism to capture "run" error, will throw an exception, the exception is captured by a java code block. Java may appear abnormal operation of the treatment period is the best code at compile time processing and capture. java Error handling is done through an exception handling model, then the error exception handling module can handle a run-time error 20Java may appear abnormal operation of the treatment period is the best treatment code at compile time and capture. The method may be used to declare the internal throws abnormal. . 3) throws declaration (s) abnormal; the throw thrown . 4 ) of the Java exception unchecked (the compiler does not require unusual disposal mandatory): Exception (Sub comprises a RuntimeException its runtime class) and error (error). Java compiler does not require that you must take it or capture must continue to throw, but checked exception (checked exception) requires you to be on the inside or capture method or continue to throw. java.lang.ArithmeticException class is a subclass of RuntimeException, when an exceptional arithmetic condition occurs, an exception will be thrown java.lang.ArithmeticException. ArrayIndexOutOfBoundsException array bounds, while also belong to the runtime exception. 5 ) the Java, all exceptions have a common ancestor Throwable. Throwable specify the code available in any common problems anomalous propagation mechanism of transmission through Java applications. It has two important subclasses: Exception (abnormal) and Error (error), both of which are important subclass of Java exception handling, each contains a large number of sub category 6 ) encounters an exception does not handle statement in the declaration method exception . 4 , JDBC . 1 ) load JDBC drivers; connection interface to establish a database connection; the Statement interface for receiving query results. DriverManger class to manage all the database drivers. 2 ) may use the Class.forName () method of the JDBC driver Java Virtual Machine classloader 3) PreparedStatement interface. Inherited Statement, precompiled, high efficiency, can bind parameters, anti-SQL injection problems. the prepareStatement parentheses () method to increase the parameter, the getInt the ResultSet interface () method, the subscript "1 Start." ExecuteQuery PreparedStatement object () method to complete the data view 4) ResultSet interface is used to provide access to the results of the query data table, the query results are returned as a ResultSet object, ResultSet object to provide "pointer", a pointer to access each row of the database table; providing a method for obtaining a large amount of data, the method returns the data in the table, whether the basic data types or reference data type; next () method is used to move the pointer to the next row of the data table, if the arrival epitope, returns a Boolean value is false, otherwise it is true. ResultSet responsible only query result set, additions and deletions to return a value by the influence of the number of rows int. 5) the step of accessing the correct JDBC database are: load JDBC drivers> establish connection with the database> Statement or create objects prepareStatement> send SQL statements and returns the obtained result> process returns the result . 6 ) at the PreparedStatement executeQuery can be used only query; insertion , delete, update with executeUpdate increase 7), modify, delete all with execute (), can also be used executeUpdate (), for in INSERT, uPDATE, or dELETE statement; query calls executeQuery (), for in a SELECT statement