Knowledge of the cursor on the database can refer to:
When using a cursor operation, the data from the query into the temporary table, then returns the first record of the temporary table cursor, and then iterate through the cursor result.
Continuing the example, assume that the records match the query of 100, ie,. MoveNext This method loops through the result set need to interact with the server 100 times. We can allow customers to set CacheSize fewer communication with the server. The above example is actually CacheSize = 1, and this is the default.
Assuming CacheSize = 4, when the RecordSet object is opened, the server sends four records to the client. The first 4 times. MoveNext operation actually get the data in the client buffer, when the first 5 times. Movenext, the server sends only the next four records. Thus, reducing the network between client and server communication.
NA me is not to say that CacheSize bigger the better? Do not take it for granted. Everything has two sides, CacheSize is the same. Client requests data, the server sends the data, this process is a bit like a traffic management. CacheSize too high, blocking the traffic, or even cause data loss (such as when the client buffer is greater than Cachesize). For different applications, different values are taken.
Also to be noted that the use of any form of the cursor is not the most effective way to access data, Cachesize sometimes not the bottleneck, as far as possible into the program using the cursor result set for the program, performance will improve a lot.
Java implementation of the ResultSet using the jdbc package according to differ:
Using mysql-connector-java-5.1.14-bin.jar, you can view the source code,
About ResultSet.next () method, with three kinds of implementation, as follows:
RowDataCursor have achieved is probably achieved with the cursor, the subject of further study.