Multiple DB support RRS feed

  • Question




    I need to provide support for multiple database (like SQL, Oracle, MySql, DB2 etc...) support in my application, In what all ways can I implement it and what are the design considerations that I need to be aware? Assume I am developing a 3 tier application in .NET framework. Could any one please guide on this?



    Thursday, June 12, 2008 7:04 AM

All replies

  • You can use the Data Access Application block from the enterprise library.


    From Enterprise Library help:



    ADO.NET 2.0 provides classes such as the DbCommand class and the DbConnection class; these classes help to abstract the data provider from any particular database implementation. The Data Access Application Block takes advantage of these classes and provides a model that further supports encapsulation of database type-specific features, such as parameter discovery and type conversions. Because of this, applications can be ported from one database type to another without modifying the client code.


    So even if you choose to switch data stores in feature it will be really easy for you.


    Also you may have to extend the block and add a new provider to support MySql. Its easy and is documented in the Enterprise library help.


    Hope it helps.



    *Saravanan Kanagaraj


    Thursday, June 12, 2008 3:57 PM
  • I would advice that you create a DAC (Data Access Code) contract and then implement all the rest of your code against this interface.

    In the implementation of IDAC you can now choose to program against IDBConnection (and the other abstractions in ADO.NET) or choose something as NHibernate... But since the rest of your application is programming against the IDAC changing the implementation of IDAC should be relatively easy.
    Friday, June 13, 2008 10:54 AM