Login failed for user OSRUNTIME when testing a query


I'm getting a weird error when I try to test a query in Service Studio.
When I test a query I get: Database returned the following error: Login failed for user 'OSRUNTIME'.
The user and password are correctly in Configuration Tool (I checked in the "Test" link), and my applications can access the database (this is the user that the plataform uses to access the database in runtime, right?).

Sometimes when I close and open Service Studio it works, sometimes it doesn't. 
Sometimes when I publish my application in the public area the test works, sometimes it doesn't.

Does anyone have any ideia why this is happening?

Hello Victor,

From your description it looks like this is a connection or permission problem regarding your OSRUNTIME user.

So we can be sure that all permissions are correctly set, you could probably recreate them by deleting and creating again the OutSystems users. To do that, please:
#1 - Delete OutSystems catalog users on <OutSystems Catalog> -> Security -> Users
#2 - Delete database logins on Security -> Logins
#3 - Create the user again on the Configuration Tool by clicking on the "Grant Permissions" button

After that please check if everything starts to work as it should.

Nuno Parreira