cancel
Showing results for 
Search instead for 
Did you mean: 

Access View from XSJS

Former Member
0 Kudos

Hi

I created a view "USERSEARCHWITHNODE" which I can access through the following code:


  var conn = $.hdb.getConnection();

  var result;

  var query;

  query = 'SELECT * FROM "API"."USERSEARCHWITHNODE" ';

  result=conn.executeQuery(query);

return result;

Everything runs quite fine until a colleague of mine tried to call the url to the service.

He got the following error:


Failed to execute action: Error: $.hdb.Connection.executeQuery: SQL error. NR: 258, ERROR: insufficient privilege: Not authorized

Is there a way to use a view even if you didn't create it yourself?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Marc,

Either you give each account the corresponding privilege, or if you don't want to create an account for each user, you might use an "anonymous database user".

This enables you to route all service calls for your project via this anonymous user.

What is described here: worked for me..

Best regards,

Daniel

Former Member
0 Kudos

Hi Daniel,

I tried to get it running with an xssqlcc but the same error occurred. Maybe i didn't get the privileges right. Which privileges does my role need exactly?

Kind regards,

Marc

//EDIT

Nevermind I gave the sqlcc the Username SYSTEM. Now I switched it to to my own User Account. Is there any reason why that is even necessary? Why is it impossible to use the view as SYSTEM user?

0 Kudos

Hm, if you created the view via SQL, it might happen that the SYSTEM User does not get the proper privleges (not sure on this fact, but I had this issue once). But it surely will work, if you create your view using the modeler.

Did you create it using SQL or did you use the View Modeler?

Best regards,

Daniel

Former Member
0 Kudos

I used SQL to create the View

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

Please look at the SAP HANA Developer Guide For SAP HANA Studio.


Tutorial: Use the XSJS Outbound API

The application package you put together in this tutorial includes all the artifacts you need to enable your server-side JavaScript application to use the Outbound Connectivity API to request and obtain data via HTTP from a service running on a remote host.Prerequisites

Since the artifacts required to get the JavaScript application up and running are stored in the repository, it is assumed that you have already performed the following tasks:

Create a development workspace in the SAP HANA repository

Create a project in the workspace

Share the new project

The HTTPDestViewer SAP HANA user role


Best Regards,

Erick Ilarraza

Former Member
0 Kudos

Hello,

Whait is your HANA revision?

Best Regards,

Erick Ilarraza

Former Member
0 Kudos

Hi Erick,

I think we got revision 97.02 (more specifically 1.00.97.01.1436865239?).


Kind regards,

Marc