Hi everyone,
I had the same requirement as Aisha, where I had to provide anonymous access to an Odata service I had created. Going through this post, the solution for this exact requirement is not quite apparent. Therefore, I present the solution as shown below. I have combined the steps and solutions provided by others in this thread.
1. Create a .xssqlcc file ... Say anonuser.xssqlcc
{
"description" : "Anon SQL connection"
}
2. Create a .xsjs file, reference the .xssqlcc file in getConnection() ...
var conn = $.db.getConnection("hana_hello::anonuser");
Which means only the above line should be in the .xsjs file.
3. Create a .xsaccess file, if not already created, with authentication = null, along with the anonymous connection statement ...
{
"exposed" : true,
"authentication" : null
"anonymous_connection": "yourpackage::anonuser",
}
4. Finally, update the "_SYS_XS"."SQL_CONNECTIONS" table. Set the username to someone that has access to the database you are trying to call. This should happen in the SQLCC application, but it doesn't seem to work ... this is the code that is in that application. Run the SQL command ...
UPDATE "_SYS_XS"."SQL_CONNECTIONS" SET username = '<database_user>' WHERE name = 'hana_hello::anonuser';
Preferably, use Thomas Jung's method to perform the above step, but if you don't have admin privileges, then the above SQL statement works fine.
Regards,
Rolan Carlo