skip to main content
Developing JDBC Applications : Fine-Tuning JDBC Application Performance : Retrieving Data : Returning Long Data
 

Returning Long Data

Because retrieving long data across a network is slow and resource intensive, applications should not request long data unless it is necessary.
Most users don’t want to see long data. If the user does need to see these result items, the application can query the database again, specifying only the long columns in the select list. This method allows the average user to retrieve result sets without having to pay a high performance penalty for network traffic.
Although the best method is to exclude long data from the select list, some applications do not formulate the Select list before sending the query to the JDBC driver (for example, some applications contain a Select clause such as SELECT * FROM table name ...). If the Select list contains long data, the driver must retrieve that data at fetch time, even if the application does not ask for the long data in the result set. When possible, the application developer should use a method that does not retrieve all columns of the table.
Additionally, although the getClob and getBlob methods allow the application to control how long data is retrieved in the application, the designer must realize that in many cases, the JDBC driver emulates these methods due to the lack of true locator support in the DBMS. In such cases, the driver must retrieve all of the long data across the network before exposing the getClob and getBlob methods.
Sometimes long data must be retrieved. When this is the case, remember that most users do not want to see 100 KB, or more, of text on the screen.