I'm just new with Oracle. But i wanna test with PHP. Which way or method should i use is the best?
I've found following various ways by googling yet,
The oci8 extension
The oracle extension
PEAR DB library
ADOdb library
Zend
or otherelse?
Actually i don't know know about these and which one is best.
Unfortunately PDO support is still considered experimental.
I've not read it, since I have no interest in oracle these days, but you might check out this oracle publication which I have not read.
Related
What is the preferred method of accessing a Microsoft SQL Server database with PHP 5.3+ on Linux?
Given the different extension options now available I'm unsure which method is preferred based on reliability and performance. Right now I am using the mssql extension with FreeTDS, but I'd like to know if this isn't the best way.
I've heard some recommend using php-odbc/EasySoft because the mssql extension has been abandoned - yet others have said going the ODBC route isn't worth the performance hit.
The response to this stackoverflow question seems to touch on what I'm asking, however it's Windows centric.
Thank you!
I've had good results using PHP's PDO (PHP Data Objects) library for this sort of thing. There's an excellent tutorial at http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/. Just make sure you use the following template to initialize your database connection:
$dbh = new PDO("dblib:host=$host;dbname=$dbname", $user, $pass);
I use FreeTDS. It's far from satisfactory. In fact, I found your question because I live in hope that there must be a better solution and I keep looking for one. Unfortunately, FreeTDS seems to be the best option at the moment, if you're developing in a Linux environment.
If you were on Windows, you could obviously use the Microsoft SQL Server drivers for PHP which would be better, but even then there are missing features, like support for PDO lastInsertId().
I am interested in using a SQLite database in my next project because it needs to be ultra-portable and a simple file that a class can connect to and use as a database seems perfect.
After Google'ing a bit I found this:
http://php.net/manual/en/book.sqlite.php
But that seems to work with an older version of SQLite and doesn't seem to be reccomended. Does anyone know what class or functions etc I should be using to use an SQLite database? I plan to write my own class for interfacing with the database, so preferably just some functions like in the link I posted but with the up-to-date version of SQLite.
Any help is appreciated, thanks.
PDO seems your best bet.
From here:
If you intend to use SQLite 3.x releases of SQLite with your development please refer to the section on PHP Data Objects, and specifically the PDO-SQLite implementation available at(references: http://us.php.net/manual/en/book.pdo.php , http://au2.php.net/manual/en/ref.pdo-sqlite.php).
PDO SQLite functions manual
Update: As #Joe mentions, there is also a standalone SQLite 3 class.
theres nothing wrong with those sqlite function, you can use them.
however there is sqlite3 http://www.php.net/manual/en/book.sqlite3.php which is object orientated.
what i personally would suggest is the adodb wrapper which can easily port to any database and is very reliable at http://de.wikipedia.org/wiki/ADOdb
I strongly prefer not to use additional 3rd party components, libraries or DLLs (at least in v1.0), unless there is absolutely no other solution.
Question: (how) can I use Delphi to progrtiamatically crate a BDE database and write to it, then use PHP to read from it?
Any URLs for examples of tutorial?
People are advising against it. Ok, the ultimate goal is some form of ODBC interface anyway. Someone mentioned ADO to me, but I don't see how to install it.
I need to crate the entire database and contents programatically in Delphi - at run time - I have no idea of it's contents or even name at compile time.
What's the simplest route for me? Thanks
Sounds like a bad idea to me, to be honest. BDE is long-since deprecated and I seriously doubt if you could get PHP to jive with it.
I would recommend using a standard database such as Firebird or MySQL for which established Delphi and PHP libraries exist, or XML if the dataset is not too large.
By BDE you mean Paradox or DBase? Wouldn't recomment using those anymore. I moved into Firebird and MySQL years ago just like Alan recommends.
Delphi supports Firebird/Interbase database out of the box AFAIK and PHP libraries exist for it. Other way around : MySQL support is in all PHP installations and there are some very good components for Delphi
The company I work for currently uses some basic functions to abstract the OCI libraries as a means for DB connectivity. We're considering switching to PHP's PDO object, but from some quick searches, it looks like the Oracle driver is a bit less mature than the other PDO drivers. I would appreciate some pro/cons for PDO/oci8 from anyone who has used it in a production environment.
Thanks!
I don't have personal experience with the PDO driver (being tagged as experimental was enough for not even considering it). But in The Underground PHP and Oracle Manual we can read the following, as preface to the PHP PDO Extension chapter:
The PDO extension and PDO_OCI driver are open source and included in
PHP 5.1 onwards. Oracle does not contribute to PDO_OCI.
The PHP community has let the PDO project languish and Oracle recommends using
OCI8 instead whenever possible because of its better feature set,
performance, reliability and stability. Use of PDO_OCI for general
purpose applications is not recommended.
The extension is not finished, it's probably poorly maintained (although some bug fixes get through now and then) and it's been that way for years. I would not put my eggs in that basket.
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.
I've created a suite of classes "PDOSurrogate" as a drop in replacement for PDO with Oracle.
When PDO is mature enough I can use Refactor->Rename to change it to PDO.
May be I'm too late to the party .. just thought to add some value to the discussion. I am experienced in OCI8 and OCI8_11 extension and have done some extensive workload using stored procedures/packages, CLOB/BLOB's and XML I never had to run out of options .. further it seems very reliable and can handle extensive loads and I have even used once for an ETL(Extract Transform Load) applications to handle heavy workloads... also believe oci8 is the widely used extension .. than pdo ..
Almost all of free web hosting server,
you can not use PDO + MySQL.
They lack PDO drivers.
So I am considering to select
pear MDB2,
or DB_DataObject.
Which do you reccomend to me?
Give me your opinions!
I would actually recommend using the Mysqli functions if you can. They are fast, well-documented and well supported by the php community at large.
If you are looking for a more robust database abstraction layer, I would first suggest that you look at any of the excellent library's out there like DataMapper, or Propel or Doctrine, or even using the necessary portions of a framework like Zend. As further note, I've used Adodb in the past, but haven't seen much support for it recently.
I've used MDB2 quite a bit but have found the built-in mysqli functions to be fast and easy-to-use, plus they can integrate easily into a roll-your-own db abstraction layer.
DB_DataObject depends on MDB2, so you have to have it anyway.
The question is : do you need just bare database independence or more advanced ORM (that's DB_DataObject).
I'd suggest you stick with MDB2 since you seem confused about this stuff.
You can use DB_DataObject with MDB2 without problems.
ADOdb is also good.
The PHP version currently supports an amazing number of databases, thanks to the wonderful ADOdb community: MySQL, PostgreSQL, Interbase, Firebird, Informix, Oracle, MS SQL, Foxpro, Access, ADO, Sybase, FrontBase, DB2, SAP DB, SQLite, Netezza, LDAP, and generic ODBC, ODBTP. The Sybase, Informix, FrontBase and PostgreSQL, Netezza, LDAP, ODBTP drivers are community contributions.