Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Connecting to HANA with PHP on Linux

$
0
0

Hi,

 

Has anyone been successful connecting to HANA with PHP on a Linux server?

 

FYI: How to connect to HANA with PHP on a Windows server is described here: http://scn.sap.com/community/developer-center/hana/blog/2013/01/21/php-rocks-on-sap-hana-too

 

The HANA ODBC connection succeeds on the Linux server.

 

Connecting to MySQL with PHP using ODBC on the Linux server succeeds as well, i.e. PHP and ODBC are setup correctly.

 

This is the connect string in PHP to connect to HANA:

 

$conn = odbc_connect("HDB","SYSTEM","secret", SQL_CUR_USE_ODBC);

 

PHPINFO: http://dbod.sapvcm.com/phpinfo.php

 

Thanks

 

 

 

hana:/usr/sap/HDB/hdbclient # ./odbcreg HDB SYSTEM secret

 

ODBC Driver test.

Connect string: 'DSN=HDB;UID=SYSTEM;PWD=secret;'.

retcode:      0

outString(56):     SERVERNODE={hana:30015};DSN=HDB;UID=SYSTEM;PWD=secret;

Driver version SAP HDB 1.00 (2013-01-22).

Select now(): 2013-02-07 12:34:36.608000000 (29)

 

hana:/usr/sap/HDB/hdbclient # isql -v HDB SYSTEM secret

+---------------------------------------+

| Connected!                            |

|                                       |

| sql-statement                         |

| help [tablename]                      |

| quit                                  |

|                                       |

+---------------------------------------+

SQL> quit

 

hana:/usr/sap/HDB/hdbclient # odbcinst -j

unixODBC 2.2.12

DRIVERS............: /etc/unixODBC//odbcinst.ini

SYSTEM DATA SOURCES: /etc/unixODBC//odbc.ini

USER DATA SOURCES..: /etc/unixODBC/odbc.ini

 

hana:/usr/sap/HDB/hdbclient # odbcinst -q -d

[HDBODBC]

[myodbcdriver]

 

hana:/usr/sap/HDB/hdbclient # odbcinst -q -s

[HDB]

[myodbc]

 

hana:/usr/sap/HDB/hdbclient # odbcinst -q -s -n HDB

[HDB]

Driver=HDBODBC

ServerNode=hana:30015

 

hana:/usr/sap/HDB/hdbclient # odbcinst -q -d -n HDBODBC

[HDBODBC]

Description=SAP HANA ODBC DSN

Driver=/usr/sap/HDB/hdbclient/libodbcHDB.so





Viewing all articles
Browse latest Browse all 6412

Trending Articles



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