DriverMannagerPublic static Connection synchronized getConnection (String url) throws SQLException; Public static Connection synchronized getConnection (String url, java.util.Properties info); // Properties included for the particular parameters required for the database. Public Static Connection Synchronized getConnection (String URL, String User, String Password); Note: All of these methods are synchronized, meaning that multiple applications cannot directly get the same Connection object. Public static void setlotintimeout (int standards); public static void getlotintimeout (); can scroll-on and updatable result sets before JDBC2.1, in the default, the result set created by executing statements can only scroll forward . That is to say, only the next () method can navigate in the result set. When the last record is reached, the next () method will come back to False without obtaining more record information. The rolling result set includes a correlation scrolling untrue result set that is forward scrolling and rear scrolling scroll indicates a static snapshot after the query execution. The rolling related result set, after the query is executed, the modification of the data is very sensitive, so it represents a dynamic snapshot that can know data change. A modified result set result set is read only in the default. That is, the contents of the result set are read-only and cannot be modified. The modified result set, when the result is modified, the modification operation modifies the original data according to the data in the result set. The rolling result set java.sql.resutset interface defines three types of result set: type_forward_only type_scroll_insensitive Two-way scroll Type_Scroll_Sensitive This result set, after the result set is obtained, the modification of the data is very sensitive. For example, if the query returns a ten row data, and another application deletes two lines, then the result is set only with eight rows of data.
The method and the location of the cursor: public boolean isBeforeFirst () throws SQLException public boolean isAfterLast () throws SQLException public boolean isFirst () throws SQLException public boolean isLast () throw SQLException for scrolling method: public boolean first () throws SQLException public boolean Last () THROWS SQLEXCEPTION PUBLIC BOOLEAN ABSOLUTE (INT ROW) THROWS SQLEXCEPTION / / ABSOLUTE moves the cursor position to the specific line in the result. The line parameters can be positive or negative, and negatively move the cursor to the opposite direction, is forward forward Move. Public Boolean Relative (int Row) This method moves the cursor to another according to the current position of the cursor. When the cursor position is invalid, this method should not be called. For example, the loop calls next () until Next () returns false (the last update of the result set) should not be called. Before calling relative (), you should use the Absolute (), the first () or Last () method to set the marker in a valid location. public boolean previous () throws SQLException direction and size of the data acquisition methods: public void setFetchDirection (int direction) throws SQLException // this method takes data .java.sql.ResultSet direction defined interface defines three directions acquired constants ResultSet.FETCH_UNKNOWN , ResultSet.Fetch_forward and resultSet.Fetch-Reverse. These constants indicate the current data acquisition direction in the result. Public V Oid setFachSize () throws sqlexception // This tells the JDBC drive, the number of rows to be obtained from the database. Note that when the size is set to 1, then when NEXT () is called, the result set will be from the database each time. Get data. By setting a larger gain size, you can get more rows at once, so that the acquisition process can be optimized. Changeable result set: modified result set, when the result set is modified, the update operation will follow the current The concentrated data modifies the original data. Concur_read_only concur_updateable can be modified.
(Defined in the ResultSet) 1. Update a line Update *** () method Update the result set The element in the current row PUBLIC VOID UPDATETIMESTAMP (INT ColumnIndex, TimeStamp X) Public Void UpdateTimeStamp (String ColumnName, TimeStamp X) When calling these After the method, the updaterow () method should be called to update the modifications made. Alternatively, you can call the cancelroPdate () method to cancel the completed modification. The RowUpdate () method is used to determine if the current line is modified. The return value depends on the result. Whether the set can detect updates. 2. Delete one line can call the deleterow () method to delete the current row from the result set, and submit the database.rowdeleted () method is used to determine if a row has been deleted. Note, a deleted row It is possible to capture this empty position in the result set. 3. Insert a line to insert a row in the result set, and submit to the database, first call the MoveToInSertrow () method, call MoveToInSertrow () to move the cursor Go to the inserted row. The inserted row is a cache line associated with the updatable result set, calls the update *** () method setting other elements in the row, after the end, the insertrow () method should last I really insert a line in the database. ResultSetMetadata resultsetadata metadata = rs.getMetadata (); getColumenClassName (INT i); // Returns the class name GetColumentypename (INT i) of the column java data type; // Return to the column DB data type GetColumnConut (); // Returns the number of columns in the result set. GetColumnLabel (INT i); // Returns the number of printed numbers and reality recommendations GetColumnName (INT i); // Get column name ISAUTOINCREMENT (INT i); // Column Whether the automatic count is read-only. IsnULlable (INT i); // does this column i can put a null value about things support TRY { // begin a transaction connnection.setautocommit (false); statement statin (); // update table1 sttement.executeUpdate ("Insert Into Table1 ~~~~~~~~~~~~"); // Update Table2 statment.executeUpdate ("Update Table Table2 ~~~~~~~~~"); if (Something) {// Business Logic successmeded Statement.executeUpdate ("Sqlstring");