Home >Backend Development >PHP Tutorial >php and odbc connect Trafodion instance

php and odbc connect Trafodion instance

小云云
小云云Original
2018-03-16 15:50:561470browse

PHP is an efficient dynamic programming language, while ODBC is a software-driven tool for connecting programming languages ​​and data storage. Through the ODBC driver, you can use PHP to connect to various databases, including MySQL, PostgreSQL, etc., and of course Trafodion. The following describes how to configure PHP to connect to the Trafodion database and perform simple database queries.

1 Install PHP tools

yum install -y php php-odbc

2 Open the PHP interactive command line to test that PHP installation is successful

php -a

3 Install Linux ODBC and configure the ODBC driver of the Trafodion database
For details, please refer to http://blog.csdn.net/post_yuan/article/details/54631881

4 Use PHP command line test connection to database

$conn=odbc_connect("traf","zz","zz");$sql = "SELECT current_timestamp as ts from dual";$rs = odbc_exec($conn,$sql);
odbc_fetch_row($rs);$result = odbc_result($rs,"ts");echo $result;
odbc_close($conn);exit;

The above is the detailed content of php and odbc connect Trafodion instance. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn