hi , I am using AX 2012, with Connection class, I can direct call SQL stored procedure.
wondering, the connection class able to connect to remote sql server? say I have sql server S1 and S2, S1 is current AX db, so, if I call the stored procedure that in same server but different database , I can use statement below to get result
ConnectionsqlConn = new Connection();
Statementsqlstatement = sqlConn.createStatement();
SqlStatementExecutePermission perm;
Resultsetrs;
StringsqlString;
sqlstring =strfmt("execute [dbname].[dbo].[mySPname]");
perm = new SqlStatementExecutePermission(sqlString);
perm.assert();
rs = sqlstatement.executequery(sqlstring);
while (rs.next())
{
(loop result set)......
}
but if I want to call S2 server stored procedure and added in the server name in the sqlstring statement, will get error,
sqlstring = strfmt("execute [S2].[dbname2].[dbo].[myspname2]" );
"A server cursor cannot be opened on the given statement or statements, Use a default result set or client cursor."
Is above statement incorrect?
note: the above class Runon server, and I would prefer use Connection class instead of ODBC.
thanks you.