Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: How to upload data with an HANA Cloud Trial Account

$
0
0

Hello Christian,

 

I didn't try to upload such a big file on the HANA trial account. So I cannot say if it is a restriction of the trial landscape or a specific problem with your settings. I just can say, that the upload of such big files is possible in general for HANA (we did it already for onpremise machines with files greater than 500 MB).

 

One option for you would be to upload your data with the help of the nodejs hdb-client via a db tunnel created with the console client. For that some steps are necessary:

  • Download and install nodejs on your machine (Node.js).
  • Download the Java EE 6 Web Profile SDK from SAP Development Tools for Eclipse
    • Within the SDK you find a folder called "tools" which contains the console client (neo.bat or neo.sh (if your are on a Mac machine)).
    • With the console client you can create a db tunnel to your HANA instance in the trial landscape. Execute the command "neo open-db-tunnel -h hanatrial.ondemand.com -i <instance> -a <account> -u <user>" in a console. <instance> is the name of the HANA instance you have choosen in the HCP cockpit. <account> is user HCP account (e.g. pxxxxtrial). <user> is your user name (e.g. pxxxx). If it worked successfully you get an information that the tunnel is opened. In addition some further information is displayed like the DEV_xxx user ID and the password which are necessary in the nodejs application.
      Some additional information can be found here: SAP HANA Cloud Platform
  • In the attachment you find an implementation for an upload program (hdb_upload_data.js). It is the nodejs implementation which reads data from a CSV file and inserts them into a table on the HANA DB. For the example it reads a CSV file with structure "ID;LAST_NAME;FIRST_NAME" and inserts it into a table with a corresponding structure. So depending on your needs you have to adapt the coding a little bit. Do following steps:
    • Save the file in a folder on your local machine.
    • Install the required nodejs modules with npm install command via a console opened for the folder:
      • fast-csv for csv handling: npm install fast-csv
      • hdb for HANA connection: npm install hdb
    • Adjust the coding of the hdb_upload_data.js file:
      • Within hdb.createClient set user to the DEV_ user name displayed in the console client window. Also the password has to be set to the password displayed in the console client window
      • Adjust the csv file name (and path if your file does not lie in the same folder). In the example I called it testfile.csv.
      • Within function upload data set the variable table_name to the table name into which you wanna store the data. Also adjust the INSERT command to your needs (e.g. if you have five columns, than the INSERT command has to be adjusted that the five columns are supplied).
  • After you have done that you can execute the nodejs application by calling "node hdb_upload_data" within the console. If everything is ok, your data will be uploaded.

 

Best Regards,

Florian


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>