Wednesday, July 14, 2010

Database Independence...

Write one database code independent of DBMS ....


We will write the SQL to the lowest common denominator ... Should not use Vendor's Extensions ...

Sounds like noble cause ....


Let us translate into real world scenario ...

I have Chevy Impala which has built in OnStar and BMW with built in GPS ... We should not use as this is not common across these vehicles ....

Sounds right ? ....

For an example , Oracle has unique features like Connect By , Analytics , MODEL clause , Bitmap Index , etc.,  and SQL Server has filtered index , ....
These DBMS are catching up to each other on some of the features like PIVOT , Analytics ,...

Besides these , locking and concurrency is implemented in totally different way between these DBMS.

If you assume , this is the way it is supposed to work in Oracle from SQL Server's perspective , you could be in surprise.

Best way to learn a DBMS , is to learn the DBMS from the scratch ( unlearn the stuff from other DBMS ) .

Best way to use the DBMS is to explore the features of that DBMS ( be it Oracle , DB2 , Sybase / SQL Server , MySQL .. )  and use it to the fullest extent possible.

Best way to achieve database indepdence , is to have transactional APIS built into the application that will call the database with packaged procedures / functions ( in oracle ) or Procedures and Functions ( in Non Oracle ) .... ie , there will no embedded SQL ....  By this method  , we can utlize the DB-centric calls properly ...

We can have the cake and eat it too :- )