How to use PHP to connect to an Informix database?
First, I would like to introduce the problem.
I have a Informix database that is currently used by 300 staffs (average is around 100,000 records/query) that make this server work slowly. Current architecture is:
Informix DB ⟷ Web Application
Now I want to implemen开发者_开发百科t the new system by adding new MySQL server with the following architecture
Informix DB ⟷ MySQL Server ⟷ Web Application
In MySQL Server I would like to copy the database from Informix to MySQL server by using PHP + Cronjob.
The questions are:
- Is there has any ODBC / JDBC driver (must be FREE!!) in LINUX for connecting to Informix?
- How to use it?
PHP has an extension for connecting to Informix. See the manual pages here: http://php.net/manual/en/book.ifx.php
You can also use the PDO extension with its Informix driver: http://php.net/manual/en/ref.pdo-informix.php
In both cases, you need to ensure that your copy of PHP has been built with those extensions. You can check what extensions are in your copy of PHP by seeing the output of the php_info()
function. If it doesn't include the relevant extensions, then you'll need to rebuild your copy of PHP to include them.
The IBM Informix ClientSDK (CSDK) includes both ODBC and JDBC drivers, and can be obtained free of charge. If you want support for the software, there is a charge, of course.
If you go to http://www.informix.com/ (the www
is crucial; omit it and you get to the IBM home page), you get directed to http://www.ibm.com/software/data/informix/. The free database editions include CSDK in the download. It is possible to get CSDK standalone, without the server, too. And IBM Informix Connect (I-Connect) is the runtime part of CSDK.
You can connect to Informix from PHP with PDO Informix or PDO IBM modules.
精彩评论