php - Call to undefined function odbc_connect() message while connecting SAP Hana database -


i used odbc_connect() in php page connect hana database. works fine when run locally. upload same php page server , getting error:

fatal error: call undefined function odbc_connect() 

the code:

$connect = odbc_connect("team6datasource", "team6", "password1", sql_cur_use_odbc); 

team6datasource = datasource name.

ip address = 54.217.234.218

can 1 please me? thanks

i go through in google this instruction helpful you.

  1. download sql server odbc driver php client
    platform.
    (registration required.) if sql server odbc driver not available platform, check list of
    odbc-odbc bridge client platforms. odbc-odbc bridge an
    alternative sql server solution easysoft, can download site.
  2. install , license sql server odbc driver on machine php installed. installation instructions, see odbc driver documentation. refer documentation see environment variables need set (ld_library_path, libpath, ld_run_path, shlib_path depending on driver, platform , linker).
  3. create odbc data source in /etc/odbc.ini connects sql server database want access php. example, sql server odbc data source connects sql server express instance serves northwind database:

    • use isql test new data source. example: cd /usr/local/easysoft/unixodbc/bin

    ./isql -v mssql-php

[mssql-php] driver                  = easysoft odbc-sql server server                  = my_machine\sqlexpress user                    = my_domain\my_user password                = my_password 

please copy , paste script , execute

<? /* php mssql example  replace data_source_name name of data source. replace database_username , database_password sql server database username , password. */ $data_source='data_source_name'; $user='database_username'; $password='database_password';  // connect data source , handle connection. $conn=odbc_connect($data_source,$user,$password); if (!$conn){     if (phpversion() < '4.0'){       exit("connection failed: . $php_errormsg" );     }     else{       exit("connection failed:" . odbc_errormsg() );     } }  // query generates result set 1 record in it. $sql="select 1 test_col";  # execute statement. $rs=odbc_exec($conn,$sql);  // fetch , display result set value. if (!$rs){     exit("error in sql"); } while (odbc_fetch_row($rs)){     $col1=odbc_result($rs, "test_col");     echo "$col1\n"; }  // disconnect database database handle. odbc_close($conn); ?> 
  1. replace data_source_name, database_username , database_password sql server odbc data source, login name , password.
  2. to run script under apache, save file below apache web server’s document root directory. example, /var/www/apache2-default/php-mssql-connection.phtml. view file in web browser:

    http://localhost/php-mssql-connection.phtml 
  3. if web browser not running on same machine web server, replace localhost web server’s host name or ip address.
  4. to run script command line, save file.

    for example, /tmp/php-mssql-connection.php. run $ php /tmp/php-mssql-connection.php.

further more details refer link


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -