Timeouts stopping executing sql proc via x++

I am using the simple x++ code to call a stored proc in sql (ex: dynamicsuser.net/…/202569.aspx)) it works great for small procs I can iterate through the result set and everything. However when I call a stored proc that takes 2-3mins to run in SQL I get the following error "The X++ execution paused. Do you wish to continue." I know its timing out somewhere. I tried connection.cancelTimeOut(connection.getTimeOutTimerHandle()); and Statement.cancelTimeOut(Statement.getTimeOutTimerHandle()); hoping it would cancel the default timeout settings but it did not. Is there a way to increase the timeout?

I’ve never played with this scenario, nevertheless let’s try some ideas.

You call it synchronously, I guess. Does it happen in batch too?

Do you mean by creating a batch class and scheduling it? I have not I will give that a try, however I think its more in the nature of x++ to pause an execution if it does not have any activity within a certain amount of time.

X++ is just a language, it doesn’t have any behavior by itself. I would agree that it’s probably some timeout for DB connection or something, but it would make sense to me if asynchronous execution or CIL also make difference. I don’t say it will, I say that it’s worth trying.

I’ve never (in nine years) seen this exact message except when using the pause statement in code. Maybe you should verify whether it’s not the case after all.

Yes when I referenced x++ I was speaking about the stack not the common intermediate language itself. My code is pretty basic (it has no pauses) I have posted it below. I will test it via a batch class.

static void main(Args _args)

{

Connection con = new Connection();

Statement stmt = con.createStatement();

ResultSet r;

SqlStatementExecutePermission Perm;

str sql;

ResultSet ResultSet;

;

sql = strfmt(“EXEC [GenCommissionData]”);

Perm = new SqlStatementExecutePermission(sql);

Perm.assert();

Try

{

ResultSet=Stmt.executeQuery(sql);

while ( ResultSet.next() )

{

info(strfmt(ResultSet.getString(1)));

}

}

Catch(exception::Error)

{

info(" The query has an error");

Pause;

}

codeAccessPermission::revertAssert();

}

Ehm ehm… :slight_smile:

Catch(exception::Error)
{
    info(" The query has an error");
    **Pause;**
}

[:|] ahhhh haha this is what I get for doing way to many things at once. tisk tisk… Thank you!