Interacting with Other DBMSs Using PHP
Interacting with other relational DBMSs is similar to using MySQL. In this section, we outline the key functions to access Microsoft SQL Server, ODBC-compliant, Oracle, and PostgreSQL DBMSs. We illustrate how to interact with different DBMSs by presenting four rewritten versions of Example 4-1 that include different DBMS functionality.
Functions for accessing other databases, including Informix and Sybase, can be found in the PHP manual. For DBMSs that are not supported natively by PHP, ODBC can usually be used; we discuss ODBC later in this section.
Microsoft SQL Server
Similarly to the MySQL function library, there are many functions for connecting to, querying, and extracting results from Microsoft SQL Server DBMSs.
SQL Server can be used under the Microsoft Windows operating system
by making minor changes to THE configuration of PHP in the
php.ini file; these changes are discussed in the
online PHP manual. SQL Server can also be accessed from a Linux
platform by installing the FreeTDS package available from http://www.freetds.org and recompiling PHP
with the -with-sybase option; this enables both
Sybase and SQL Server support. SQL Server databases can also be
accessed using the ODBC library discussed in the next section.
Six functions are listed here, and Example 4-12 shows these implemented in a modified version of Example 4-1.
-
resource mssql_connect(stringhost, stringusername, stringpassword) Establishes a connection to a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access