You need to sign in to do that
Don't have an account?

INVALID_QUERY_LOCATOR: invalid query locator
While running a fairly long series of queryMore() calls, after about 17 minutes of activity (in 2000 record chunks), I received the "INVALID_QUERY_LOCATOR: invalid query locator" error.
I was using logic borrowed from the sample code illustrating the proper use of query() and queryMore(), and this code has previously been tested to run without errors.
Is it possible that the query locator/cursor expires after a period of time, or for some other reason became invalid?
I was using logic borrowed from the sample code illustrating the proper use of query() and queryMore(), and this code has previously been tested to run without errors.
Is it possible that the query locator/cursor expires after a period of time, or for some other reason became invalid?
Message Edited by HaroldH on 03-15-2005 02:58 PM
For large recordsets what I do is allocate a local array to hold those records, iterate through all the returned records storing them in the local array, and then processing them.
Hope that helps...
Thanks for clarifying the 10 minute inactivity timeout of a queryLocator.
Seems that using a smaller batch size (ie, less than the maximum of 2000) may help in our case, where processing those 2000 records is taking a fair bit of time.
i'm experimenting the same problem in this days.
We have an utility mathod that consume all the server records(batch size 2000) of a QueryResult and store them in a local array and then return the local array to calling methods for local complex operations.
The calling method uses more then 5 times this utility method(during his lifeline) but I can understand why we get "InvalidQueryLocator" exception.
Does QueryLocator server instance die when QueryResult comes Null?
Does QueryLocator ql=queryresult.getQueryLocator() get a new copy of the same remote QueryLocator instance?
Can I remotely manipulate my querylocator instance during a session(for example how many QueryLocator instance I hold in a specific moment)?
The ten minutes expire time concerne total query time or time between two different "QueryMore" invocations?
Does something changes in the summer edition about query expire time. Our code seems to work on the previous WSDL?
thanks in advance
Filippo
--->>>>>>>This is the method code:
public static SObject[] queryObjects(QueryResult qr, SoapBindingStub sbs)throws UnexpectedErrorFault, InvalidQueryLocatorFault, RemoteException{
SObject[] selected=null;
if(qr.isDone()){
if(qr.getRecords()!=null){
MyLogger.info(LOGGING_CLASS,"record restituiti: "+qr.getRecords().length);
}else{
MyLogger.info(LOGGING_CLASS,"record restituiti: 0");
}
selected = qr.getRecords();
}else{
Vector vso=new Vector();
while (qr.getRecords() != null) {
MyLogger.info(LOGGING_CLASS,"record restituiti: "+qr.getRecords().length);
vso.addAll(new Vector(Arrays.asList(qr.getRecords())));
QueryLocator ql=qr.getQueryLocator();
if(ql != null)
{
qr = sbs.queryMore(ql);
}
else
{
break;
}
}
selected=new SObject[vso.size()];
vso.copyInto(selected);
}
return selected;
}