cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to HANA database from vue project

Aaron
Explorer
0 Kudos

Hi!

I have a problem with connecting to my HANA database with Vue. I am able to connect to the odata service, where I can add, delete, and update the data, but I am not able to write the data back to my HANA database.

Also in a seperate project I can do CRUD operations on my database, but can't seem to connect the dots in only one project.

Can anyone suggest a solution please, or a guide I can follow?

Thanks in advance.

gregorw
Active Contributor
0 Kudos

Maybe you can share on a public Git repository a minimal sample what you already did.

Aaron
Explorer
0 Kudos

Let's just say I am at the starting point and created a Vue project from the template with my odata service as my destination (without authorization for now), now I just simply added a form to the webpage and with axios POST and GET requests, I can get/add data to the odata service,but I want to do the same with the Hana database, from which I created the service. This is where I'm stuck basically.

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor
0 Kudos

Are you sure that you connect to the right HDI container (the one from the deployed version) in the DB Explorer?

Aaron
Explorer
0 Kudos

I am so sorry for the trouble you were right I wasn't looking at the right DB I had to add it to the database explorer.

But really big thanks for the help and your time!

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

You can create a CAP application that provides an OData Service that exposes the HANA DB table. From a web application you can't directly access HANA.

Aaron
Explorer
0 Kudos

So there is no way that I can use for example a form on my Vue webpage, and put the data into the HANA DB (from which my OData Service was created), so that I can see the added data in Database Explorer?

gregorw
Active Contributor
0 Kudos

If the OData Service that you've crated (can you tell us what you've used to create the OData Service) supports POST requests you can do it from Vue.

Aaron
Explorer
0 Kudos

I have used CAP to create my OData service (created a schema.cds and service.cds binded it to a HDI container, used the mbt build shell command, and finally the cf deploy command on my .mtar file, which said that the My_app-srv was started here: *insert url*) I can use POST on this url and it adds data to the url (which i can see so it updates), but I can only see the initial data in Database Explorer, not the added ones.

Or maybe I am mistaken and call this an OData service, which it isn't?

The database and the vue web page are in different projects, because I connect the data as a destination to vue (so it automatically creates a list/table).

Aaron
Explorer
0 Kudos

Yes I checked it and it is the right one.

gregorw
Active Contributor

I would suggest that you work through the tutorial mission Build a Business Application Using CAP for Node.js and check if something is missing in your app.