Home > Article > Backend Development > php and odbc connect Trafodion instance
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!