PDA

View Full Version : How to query an Oracle database ?


dcaillon
09-25-2002, 02:38 PM
hi all,

I've got problem with Oracle querying throw PEAR library. I thought about a DLL registration into php.ini file (php_oci8.dll or php_oracle.dll).

Does anybody use PEAR to query an Oracle 7 or 8 database ? Please resume me the good way to configure my PHP server ?

thanks

firepages
09-25-2002, 07:08 PM
Hi , hate to say this and many will disagree but the PEAR DB classes are pretty pointless (IMO) unless you truly think you need database abstraction , chances however of needing to port an app from say Oracle to MySQL or MSSQL are remote at best, and even then you will still have to change some of your code..

I would suggest using the OCI functions which are about as fast as it gets when talking to oracle.

http://www.php.net/manual/en/ref.oci8.php has some sample conections using OCI

you will need to have the php_oci8.dll available (so uncomment in your php.ini) and the most common problem with Oracle/PHP/win32 is not having the correct PATH settings for the Oracle variables - its pretty much covered in the manual though.

mordred
09-25-2002, 10:31 PM
I have to agree to a certain extent with firepages concerning his points about database abstraction. If you are developing for Oracle, chances are quite high that you also use SQL that is especially tuned for this database. So switching databases would incur editing of all SQL queries anyway, unless you stick to the ANSI standard and forget about tuning your db.

On the other hand, if you are querying different databases in the same script, an abstraction layer could be useful, and also if it provides some integrated functionality you won't have reinvent again (such as creating sequence numbers that work similar to MySQLs auto_increment feature). That said, I believe your question is probably best suited in the mailing lists of the PEAR dev team:
http://pear.php.net/support.php