9

I'm working on a new project and trying to determine if I should use PDO_OCI or oci8 for a database connection. Unfortunately I don't think anyone has really compared the two.

The information I have is as follows so that you know why I'm concerned about the choice. OCI8 is developed by Oracle(AFAIK) so this seems to be a solid choice. I prefer PDO but it doesn't look like the PDO_OCI extension has been updated in some time and its still marked as experimental on the PHP docs page.

If anyone can give me any thoughts on why you would / wouldn't use one or the other so that I can go into this with a little more of an understanding of which is better that would be great.

Christian South
  • 359
  • 2
  • 9
  • 1
    The oci extension has a very similar interface to PDO (prepared statements, parameter binding, etc). I'd recommend that over anything marked "experimental". Also, there's an updated oci extension found in Zend Server. You should probably check that out too – Phil May 10 '11 at 22:30
  • I wish Zend Server was an option but in the environment I am in it isn't an option. My biggest problem with OCI8 is it is entirely functional. So for it to really compare to the PDO implementation it would have to wrapped in a class. Thanks for the comment though. – Christian South May 11 '11 at 00:03
  • 1
    Indeed, PDO_OCI is so old that it doesn't work with the latest instantclient versions; you have to edit the config script to tell it that version > 11.2 exists. – Renee Apr 02 '12 at 18:05
  • 1
    possible duplicate of [PDO/Oracle vs OCI](http://stackoverflow.com/questions/2563732/pdo-oracle-vs-oci) – soyuka Jan 20 '15 at 19:55

2 Answers2

10

I was very nervous about using PDO_OCI with the Experimental note. However, I saw a major advantage to standardizing our database connections on PDO across the corporation because of its data abstraction. I implemented some tests to make sure that data would make it to the database and that it could with stand the anticipated load. At this point it has processed about 15,000 records successfully.

The note on php.net about it says the names and function may change in a future release of PHP. I plan to test my implementation before we would upgrade to ensure the functionality hasn't changed, but we would probably do that any way.

I can say that it works well for us.

Issac
  • 197
  • 2
  • 4
2

I copy answer from this thread: Oracle, PDO_OCI vs OCI8

It seems to me that Oracle is not interested in developing a driver for PDO it's developing it's own driver to keep you close to oracle database... to oracle driver... etc. :)

As far as I've seen there is no problem if you can cope with max. texts of VARCHAR2 of 4000 CHARS. If you need CLOBs (and/or bigger) don't go with PDO_OCI.

Community
  • 1
  • 1
Rauni Lillemets
  • 2,299
  • 1
  • 26
  • 39