cancel
Showing results for 
Search instead for 
Did you mean: 

How to run batch file to invoke a .ctl file to import data from Excel into SAP HANA?

Former Member
0 Kudos

Hello friends:

I have successfully imported data from .csv into SAP HANA.

Now I have a scenario where in I want to use a batch file to invoke .ctl file to import data from Excel into SAP HANA.  The reason is I want to run the batch file at  a scheduled interval, lets say 15, 30 min.

If it is not possible, can I do a scheduled import in SAP HANA studio itself?

Thanks in advance.

Jags

Accepted Solutions (1)

Accepted Solutions (1)

jackson_john
Explorer
0 Kudos

Jags,

Are you using DataServices to run the scheduled job? Using DataServices you can schedule job to read from files and import to HANA.

Apart from Dataservices, if there is a import command that can be invoked from a Unix shell script, then you can also schedule it as a cron job.

Thanks,

Jackson

Former Member
0 Kudos

Hello Jackson:

I am not using Dataservices.

I want to run this cron job from windows box on which HANA studio is installed. Like sqlplus of Oracle is invoked from the windows command prompt (which can be used to run a cron job), is there any such option in HANA studio?

Jag

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

As part of the HANA Client installation, there is an executable called HDBSQL.  It is an operating system command line tool for executing SQL statements.  Page 20 of this guide (http://help.sap.com/hana/hana1_imdb_backup_en.pdf) talks about using the tool for running backups.  However the general setup of the hdbuserstore would be helpful for general purpose usage of HDBSQL as well.

Former Member
0 Kudos

Thanks Thomas for directing me to this document.

1. Can you please direct me to a case study or steps to run a cron job from command prompt of SAP HANA studio's machine?

2. Has anyone performed this task on SAP HANA experience on cloudshare

Hello SAP HANA development team:

Can you please guide me on this?

Former Member
0 Kudos

1. not sure what additional information you are looking for - section "Setting Up a Data Backup Using Cron" describes all the steps you need. You can also call hdbsql -h as user <SID>adm to see all the command line options.

For importing a CSV file, just replace the SQL statement. If you want to make sure there's a fresh file present for the import, you would have to write you own shell script, test for the existence of a current *.csv file and only then call hdbsql to import the file. Needs some shell scripting skills...

2. no. On cloudshare you don't have access to the OS of the server, so you cannot automate file import on the trial sandboxes. You will have to get your own HANA instance (e.g. on ). Or you can experiment with the automation from the cloudshare desktop, hdbsql.exe is also part of the SAP HANA Client (in C:\Program Files\sap\hdbclient).

--Juergen

Former Member
0 Kudos

Thanks a ton Juergen Schmerder, You've just made my day. Yes, hdbsql works from SAP HANA client and I am able to import data from command prompt.

Answers (0)