cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduling a SQL script via HDBSQL using windows

former_member212706
Participant
0 Kudos

Dear Experts,

     I have 2 SQL script saved as "Test.sql" and "Test2.sql".

In Test.sql i have 2 statements

\c -i 00 -n xx.xxx.xxx.xx:30015 -c ";" -u xxxxxx -p xxxxxxx;

\i C:\Test2.sql

In Test2.sql i have 1 statement

Call "schema"."PROC_TEST"

I am trying to schedule the call to the procedure using task scheduler in windows. I tried out 2 options

1. In the task i chose program as "hdbsql.exe" and in add arguments  "\I C:\Test.sql"

          It throws an error atating "error while parsing through protocols"

2. In the task i chose program as "hdbsql.exe" and in add arguments   "\c -i 00 -n xx.xxx.xxx.xx:30015 -c ";" -u xxxxxx -p xxxxxxx -I C:\Test.sql"

     it was successful but it didnot call the procedure.

Am a bit confused as to how to solve this issue.

Please help me .

Thanks in advance

Regards,

Rajesh.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member212706
Participant
0 Kudos

Hi experts,

I am on revision 32. pl help me here.

Thanks,

Rajesh.

Former Member
0 Kudos

Hi Rajesh,

Could you try creating a windows batch file (.bat) and call that in your schedule. In the .bat file you could add the full command ie:

hdbsql.exe \I C:\Test.sql

Regards,

Gary Elliott

former_member212706
Participant
0 Kudos

Hi Gary,

     I tried it earlier. it doesnt work . it throws an error stating"hdbsql.exe is not an internal or external command"

Please guide me.

Thanks,

Rajesh.

Former Member
0 Kudos

Hi Rajesh,

Have you added the full file path to the location of hdbsql.exe. ie,

c:\sap\hana\hdbsql.exe -l test.sql

Regards,

Gary

former_member212706
Participant
0 Kudos

Dear Gary,

It throws a different error stating "Connection failed : [RTE:[0]]

Please guide me.

Regards,

Rajesh.

Former Member
0 Kudos

Hi Rajesh,

Looks like something to do with your connection parameters. Can you double check the command you've entered. As an example, the following is the contents of a bat file that I created to test:

"C:\Program Files\sap\hdbclient\hdbsql" -n saphana1:30015 -i 00 -u SYSTEM -p xxxxxx -c ";" -I "C:\Program Files\sap\hdbclient\test.sql"

The test.sql file simply contains SELECT * FROM DUMMY

When I execute the bat file, I get.

It may be worth checking that the client version you have installed on your local machine matches the database. ie, Revision 47. Also, you've probably already seen this, but for others that come across this post, there is a good breakdown of all of the hdbsql commands at the end of the following help file:

http://help.sap.com/hana/hana_admin_en.pdf

Regards,

Gary Elliott