Error when executing direct SQL – SqlStatementExecutePermission

Sometimes it happens that you receive an error message if you have tried to execute a native SQL statement.

The reason for this is that the request for the permission of type ‘SqlStatementExecutePermission‘ failed.

(C)\Jobs\Job1 – line 25

The connection class can be used only in code running on server and therefore this behavior is shown.

You can solve this issue easily, if you use the method marked as server static and call this method from the display method.

Comments (1)

  1. sarat says:

    while i am connecting oracle DB through X++ coding i am getting the following meassge.

    Please find out whtat is the problem.

    ODBC operation failed.

    Unable to log on to the database.

    [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).

    Object 'OdbcConnection' could not be created


    This issue can occur if your connection string contains spaces. See;EN-US;929627
    for similar issue description