D
david.karr
I have a simple Oracle (10g) query with a simple where clause, and no
joins. When I run that query in SQuirreL, it gives me the 8 records
that I expect. When I run that query in a Java application running in
WebLogic 10.1, the "while" loop calling "rs.next()" returns all 8
records twice, making it seem like there were 16 records.
I use "setFetchSize(20)" on the statement. I used to use "AND ROWNUM
<= 20". Both produce the same result. I originally didn't have
"SELECT DISTINCT ...", but I tried adding that. Still no difference.
Is there something obvious that could be causing this?
The query is very simple. It just looks like this, with most of the
column names removed, and the table name changed:
SELECT ID, ... FROM TABLE_NAME tn WHERE tn.CREATION_DATE = ?
The somewhat elided code for the loop looks like this:
--------------------------
try {
rs = getRecords(connection);
// Indicates whether at least one row was found.
boolean foundOne = false;
while (rs.next()) {
foundOne = true;
final Record record = makeRecord(rs); // makeRecord() just has a bunch
of "getString()" calls on the rs.
processRecord(record, counters);
++ recordsProcessed;
}
if (!foundOne) {
break;
}
if (overTimeBudget(startTime)) {
break;
}
logInfo("Processed " + recordsProcessed + " record" +
(recordsProcessed == 1 ? "" : "s") + " so far.");
}
joins. When I run that query in SQuirreL, it gives me the 8 records
that I expect. When I run that query in a Java application running in
WebLogic 10.1, the "while" loop calling "rs.next()" returns all 8
records twice, making it seem like there were 16 records.
I use "setFetchSize(20)" on the statement. I used to use "AND ROWNUM
<= 20". Both produce the same result. I originally didn't have
"SELECT DISTINCT ...", but I tried adding that. Still no difference.
Is there something obvious that could be causing this?
The query is very simple. It just looks like this, with most of the
column names removed, and the table name changed:
SELECT ID, ... FROM TABLE_NAME tn WHERE tn.CREATION_DATE = ?
The somewhat elided code for the loop looks like this:
--------------------------
try {
rs = getRecords(connection);
// Indicates whether at least one row was found.
boolean foundOne = false;
while (rs.next()) {
foundOne = true;
final Record record = makeRecord(rs); // makeRecord() just has a bunch
of "getString()" calls on the rs.
processRecord(record, counters);
++ recordsProcessed;
}
if (!foundOne) {
break;
}
if (overTimeBudget(startTime)) {
break;
}
logInfo("Processed " + recordsProcessed + " record" +
(recordsProcessed == 1 ? "" : "s") + " so far.");
}