embedded native SQL(EXEC SQL) method to connect HANA as secondary database

Another Top-Down approach of HANA usage is EXEC SQL method which you write SQL commands between EXEC SQL/ENDEXEC lines. Difficult side of this approach is you will be dependent to static special SQL statements which does not follow ABAP syntax. For example in order to connect the HANA database ” connect to : ‘HDB’ ” statement is used. In DEMO_EXEC_SQL program you can find more samples including create/insert/read/delete statemens or check SAP Help for more details. Below i have shared a code to get a list of tables and view in your HANA db. Here i have used native SQL method to connect HANA and open/fetch/close database cursor SQL commands to extract data.

 

 

You may also like

  • ADBC usage with HANA as a secondary database (0)
    "ADBC is an API for the Native SQL interface of the AS ABAP that is based on ABAP Objects. The ADBC methods can be used to pass Native SQL statements to the database interface". It was a […]
  • CDS view approach to connect HANA as secondary database (0)
    CDS view approach is maybe the safest approach while connecting to a secondary HANA database. If there is a safer approach it would be using directly OpenSQL. However there are cases where […]
  • number of distinct values for an SAP table (0)
    As you all know SAP provides a direct way to query database by ABAP programs. However sometimes we don't have a chance to transport ABAP programs easily.On the other hand we have to write […]