CodeIgniter Forums
Connect to SAP HANA using ODBC Driver - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: Connect to SAP HANA using ODBC Driver (/showthread.php?tid=65502)



Connect to SAP HANA using ODBC Driver - Lee_Code - 06-19-2016

Hi Masters,


Does anyone of you had successfully made a connection to SAP HANA using ODBC driver?

Here's my database configuration:



$db['hana_db'] = array(
    'dsn'    => '',
    'hostname' => 'Driver={HDBODBC32};ServerNode=192.168.0.***:3**15;UID=******;PWD=********;Database= *****;',
    'username' => '*****',
    'password' => '*****',
    'dbdriver' => 'odbc',
    'database' => '*****',

);


But then I got a PHP error

Severity: Warning
Message: odbc_exec(): SQL error: [SAP AG][LIBODBCHDB32 DLL][HDB] General error;-10808 Feature (SCROLLABLE RESULT) not implemented yet in module: d:\depot\bas\IMP\NewDB100_REL\src/sys/src, SQL state S1000 in SQLExecDirect
Filename: odbc/odbc_driver.php
Line Number: 138


Need your help on this,

Thanks


RE: Connect to SAP HANA using ODBC Driver - Alphen - 06-21-2016

Have you tried to change ODBC driver configuration and set the cursor type to a forward only cursor ?


RE: Connect to SAP HANA using ODBC Driver - Lee_Code - 06-21-2016

(06-21-2016, 07:27 AM)Alphen Wrote: Have you tried to change ODBC driver configuration and set the cursor type to a forward only cursor ?

Got it working by changing the odbc_driver.php file

public function db_connect($persistent = FALSE)
    {
        return ($persistent === TRUE)
            ? odbc_pconnect($this->dsn, $this->username, $this->password, SQL_CUR_USE_ODBC)
            : odbc_connect($this->dsn, $this->username, $this->password, SQL_CUR_USE_ODBC);
    }


Thanks Bro, Great help!