Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> JDBC: rs.next() is slow

JDBC: rs.next() is slow

From: Jochen Wiedmann <jochen.wiedmann_at_softwareag.com>
Date: Thu, 20 Nov 2003 07:30:03 +0100
Message-ID: <bphmta$1h9p$1@news.wplus.net>

Hi,

I have problems with the speed of a certain query. My first though was, that the query itself is slow, but it turned out that the server replies quite quickly. Looking at the following code:

       logger.debug("Starting query"); int i = 0;
       ResultSet rs = stmt.executeQuery();
       try {
         for (;;) {
           logger.debug("Fetching result row " + i++);
           if (!rs.next()) break;
           logger.debug("Creating result object");
           ValueSet value = newValueSet();
           logger.debug("Filling result object");
           manager.fill(rs, value);
           logger.debug("Adding result object");
           result.add(value);
         }
         logger.debug("Done query");

When the query is invoked, I find that the executeQuery() and the first 10 iterations are executed immediately. However, when rs.next() is invoked for the 11th time, I note a delay of some seconds (!). The same problem occurs when invoking rs.next() for the 21st, 31st, ... time.

What is strange even more: The problem seems to depend on the machine. A colleague of mine receives a quick response.

I am using Windows XP, Java 1.4.2_02, ojdbc14.jar, server version is unknown. Network adapter and CPU load are almost zero while the delay happens.

Glad about any response,

Jochen Received on Thu Nov 20 2003 - 00:30:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US