473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Which database extension? PDO or DB or ODBC?

I need to program generically. I am familiar with the ODBC layer but
never used PDO or DB.

Does anyone have any experience with these database layers?

Thanks

Apr 30 '06 #1
4 5115
Hello,

on 04/30/2006 04:20 PM ImOk said the following:
I need to program generically. I am familiar with the ODBC layer but
never used PDO or DB.

Does anyone have any experience with these database layers?


None of them provides database independence. If you want to switch
databases later, you need to rewrite part of your code.

Personally I use Metabase, which provides database independence not only
at the access level, but also at the database schema installation level.

http://www.phpclasses.org/metabase

There is also PEAR::MDB2 is a follow-up of PEAR::MDB that was derived
from Metabase .
--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Apr 30 '06 #2
On Sun, 30 Apr 2006 20:20:33 -0300, Manuel Lemos wrote:
None of them provides database independence.


Actually, nothing provides database independence. Database independence is
a myth. Databases have different locking strategies, deal with connections
in different ways, optimizers are vastly different and will produce
different execution plans for the same query, on the same underlying
physical strategies, some support things like local temporary tables, some
call them cursors, some have bi-directional cursors, some do not, the
procedural extensions differ from database to database, as do limitations
of what you can do with triggers, in some cases readers block writers, in
others do not, some databases support bitmap indexes, some do not etc,
etc, etc. The term "relational database" practically means "supports SQL
as defined in ANSI 92 standard". That's it. Databases are so different
beasts that there is no way you can write a "database independent
application". I saw several attempts to do so, by using Java and object
relational mappers. General characteristics of such an application
are:
1) It tries to enforce business rules in the application and tries
to disregard stored procedures and triggers of the underlying
database. It's special fun when somebody else develops another
application using the same data and understands the business rules in
a different way. Logical corruption follows.
2) It tries to create its own security mechanism, based on the application
server and LDAP server. Not only does it duplicate the database
mechanism, it's much more easily hacked as it is one layer closer to
firewall then the database.
3) It resolves concurrency problem by creating "services" which are
essentially queues which perform certain type of transaction. This,
usually, creates a bottleneck, so the whole thing is "scaled" by
distributing the load over several servers. Now, we have deadlock
problems, which are resolved by creating new "services". The whole
vicious circle starts anew.

In other words, the only database independent applications that I've ever
seen suck equally on all underlying database. I do have considerable
database experience. I am Oracle DBA for 17 years, I have experience with
CICS DL/I, DEC RDB, PostgresSQL and SQL Server 6.5. Trust me, I've seen
many amazing things in this world, but I haven't seen such a creature as
"database independent application". If it exists, it must have been
written by a Sasqwatch or Nessie, because I haven't seen it so far.

--
http://www.mgogala.com

May 1 '06 #3
Mladen,

I agree about your assesment about the myth of database independence
and each DB engine has its own specialties.

My requirements are simple:

- Use SQL Server or MySQL
- No triggers (will be done in code)
- Minimal in application engine configuration (will be done in
configuration files).
- No relational management (will be done in code).
- Transactions/Commit/Rollback.
- Portability to Linux (MySQL).
- Simple datatypes.

I am just looking for people's experiences with these 2 extensions as
far as performance.
What would you say is the best extension to use between DB or PDO given
my simple requirements?

Thanks

May 1 '06 #4
ImOk wrote:
Mladen,

I agree about your assesment about the myth of database independence
and each DB engine has its own specialties.

My requirements are simple:

- Use SQL Server or MySQL
- No triggers (will be done in code)
- Minimal in application engine configuration (will be done in
configuration files).
- No relational management (will be done in code).
- Transactions/Commit/Rollback.
- Portability to Linux (MySQL).
- Simple datatypes.

I am just looking for people's experiences with these 2 extensions as
far as performance.
What would you say is the best extension to use between DB or PDO given
my simple requirements?

Thanks


I don't have any experience with these extensions. My philosophy is a bit
different.

I'll build layers of classes. The database layer contains the database-specific
calls (i.e. mysql_query). The next layer is the tables, which are derived from
the database layer. Simple one-table SQL statements go in here. On top of that
are the business objects, which communicate with the one or more table objects
to communicate between the tables and my program. I'll have multi-table SQL
statements here.

If I need to change databases, I just need to change the top layer - one class.
If I need to change the table layout, I have to change the table layer, and
probably some in the business object layer.

But any changes in the database are completely isolated from the web pages
themselves.

Simple queries result in relatively simple classes. I admit there are problems
when I get more complicated queries, but I'd have the same complications anyway.
This way I keep everything outside the web page code. And changes are limited
to a few classes instead of dozens or potentially hundreds of pages.

I admit this would be a lot of extra work for a small site. There you could
combine the table and business layer objects. But you still have database
independence and no SQL or other database specific code in your app.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gregs | last post by:
Hi folks, I need to know which EXE's of SP3 to install with SQL Server 2000 Personal Edition. From the Microsoft website: ...
2
by: Nate | last post by:
Hello, I am trying to recover a SQL Server 7 database from another hard disk drive that has a corrupted Windows 2000 Advanced Server installation. I am not able to repair the corrupted Windows...
3
by: Markus Keuthmann | last post by:
Hi, is it possible to connect to a DB2 database through PHP WITHOUT ODBC like in MySQL? Example MySQL: // Open the database connection and use the sample // database $connection =...
9
by: Albretch | last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers. I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver From some reason both drivers Exceptions tell me...
0
by: Ryan | last post by:
Hello, HELP! I have TWO questions: First, I am trying to execute a SQL pass-through query in Access VBA. According to MSAccess help, I should be able to use the following syntax after...
9
by: Luke Vogel | last post by:
Hi all. This is a bit of a newbie type question. I am trying to figure out what is the best way to connect to a database; ado.net, odic others? I've found a couple of examples that show you...
2
by: Randy | last post by:
Hi,all I met one problem of connecting Access database in asp.net web program. I use ODBC link to Access, the connection string like "PWD=12345;DSN=QADLinkMDB;DriverId=25;MaxBufferSize=2048;FIL=MS...
4
by: ryan.barnard | last post by:
Hi all, I have a database that was created back on November 29, 1993. It has an MDB extension, but try as I might I cannot figure out how to open it up. Access 2003 says "Unrecognized database...
3
by: ksarkies | last post by:
Hi This is a "problem" I've been battling for many days and haven't been able to understand; various postings I've come across on the Internet seem to not quite provide the answer. We have a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.