Skip to Content

I am a part of Product Security APJ team which is developing a tool that uses MySQL as a database. Few days back we decided to shift to SAP HANA due to performance issues. Due to this one of the major challenge that we faced was in making connection to SAP HANA through PHP. It was hard to find discussions related to this problem which led to referring multiple HANA docs. Once we came up with a solution, we thought of consolidating the solution and make it available for others.

Below are the steps to connect to SAP HANA using PHP (32bit)

Installing HANA client on Windows:


     1) Go to the folder where the DUMP (build of HANA client 32bit) is available using command prompt.

     2) Write the following command.

        hdbinst -a client

     3) Restart the windows system.

Connecting to the HANA DB through PHP:

   Use the below code to make the DSN less connection to SAP HANA

   odbc_connect("Driver={$this->driver};ServerNode=$this->server;",$this->user, $this->passwd, SQL_CUR_USE_ODBC);

   

     where,

     driver – name of the HANA driver installed (HDBODBC32)

     server – path or location where the HANA DB resides.(Eg: inblrlxxx.dhcp.blrl.sap.corp:300XX)

     user – username for a particular database you want to connect.

     passwd – password for a particular database you want to connect.

   

Similarly to connect to SAP HANA through Python in Windows 7, explanation is provide in my other post: Connecting to SAP HANA through Python in windows 7


To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply