Re: Multiple Database Support - .NET 2.0

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



David Browne wrote:

>
> "Rasheed" <Rasheed@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:A6FD97EC-4BE2-42AE-9913-718E94A3A7BF@xxxxxxxxxxxxxxxx
> > We are in the inception phase of architecting a .NET based multi
> > tier application. Due to the .NET technology advancements, we have
> > decided to go
> > with .NET 2.0 beta 2 for development.
> >
> > One of the objectives is to support multiple databases (SQL,
> > SYBASE, ORACLE
> > and DB 2).
> >
> > We are considering few ORM tools to accomplish the above
> > (nHibernate and gentle.NET). However, we would like to know if
> > there is anything available in
> > .NET 2.0 that we should consider (other than DAAB). I remember,
> > Microsoft was
> > working on object spaces and not sure of this will be available in
> > .NET 2.0.
> >
>
> There's much better support in ADO.NET 2.0 for transparently
> operating with multiple databases. There's a much more complete set
> of abstract interfaces and classes to let you write data access code
> that's not bound to any particular database. See:
>
> Generic Coding with the ADO.NET 2.0 Base Classes and Factories
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs0
> 5/html/vsgenerics.asp

Yeah, and that falls apart as soon as you're trying to insert a row
into a table... for example: sqlserver has named parameters, DB2
doesn't. sqlserver uses SCOPE_IDENTITY() for identity fields, oracle /
firebird use sequences.

i.o.w.: the SQL is not database generic. So the classes are, but that
will not bring you very far.

> This is something different than Object-Relational Mapping (ORM).
> Generic ADO.NET coding just lets you write database code without
> targeting a particular database platform. ORM is intended to
> eliminate writing database-oriented code entirely. It hides not only
> which database, but the fact that there's a database at all.

it moves the focus from tables + queries to object sets and filters.

> Consequently ORM is very difficult to "get right", and using ORM for
> data-intensive applications can have a significant impact on the
> performance, concurrency and complexity of your application.

huh? Not at all. After all: O/R mappers generate SQL, so instead you
typing it, it's generated for you. And often smarter than you could do
it.

> So the promise of ORM is that you can forget about the database, and
> live in OO land. But in reality, you often have to become an expert
> in your particular ORM technology AND your database to work around its
> limitations.

nonsense. That is: if you use the proper O/R mapper of course. For
example, with LLBLGen Pro you can write pure db generic code, without a
single SQL statement, all typed. Read a customer object from oracle,
change some fields, and save it in sqlserver, without hassle.

And you don't need to become a true expert or fight with limitations.
Within a month (it's going beta this week) we're releasing our Type
converter technology which allows you to use entities with for example
boolean and for example GUID fields on sqlserver AND oracle (or any
other db we support), where the framework will take care of converting
int16 (or char1 or whatever) to bool and back, so you can keep your
sqlserver entities and work with them on oracle as well, without
worrying about the limitations of _oracle_ in the type department
(oracle doesn't support guid or bit types)

> For instance in Oracle when you compare a VARCHAR to a CHAR, they
> will not match unless the VARCHAR is right-padded with spaces to the
> length of the CHAR.

That's with every db. CHAR's are padded with spaces. Though from .NET,
with a parameterized query, you will be able to compare "Foo" with a
char(20) field and a varchar(15) field and get expected results (e.g.
no need for padding)

FB

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
.



Relevant Pages

  • Re: Multiple Database Support - .NET 2.0
    ... > expert>> in your particular ORM technology AND your database to work ... >> from oracle, change some fields, and save it in sqlserver, without ... Method Enter: CreateSelectDQ ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Size of SQLServer databases with indices
    ... > I am starting to examine using SQLServer instead of Oracle. ... I then checked the size of the database. ... In SQL Server, yes, indexes take up space. ...
    (microsoft.public.sqlserver)
  • Re: ADO.NET and SQL, Oracle
    ... Miha Markic [MVP C#] wrote: ... >> at the moment a large pack of feature which are absent in SqlServer ... > I like Sql server more than Oracle becuase: ... > Perhaps Oracle is a better database ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: synchronization with heterogeneous tables and referential integrity
    ... In my application's database design there are entities which have foreign keys referenced to some tables that should be maintained by the accounting application in SQLServer. ... My idea is to build "shadow" tables in Oracle with the same structure of the SQLServer tables and implement a scheduled batch process that keep them synchronized with SQLServer using a database link and Heterogeneus Services. ...
    (comp.databases.oracle.server)
  • Re: Multiple Database Support - .NET 2.0
    ... we do not have any previous experience with ORM ... >>> SYBASE, ORACLE ... >> that's not bound to any particular database. ... sqlserver has named parameters, ...
    (microsoft.public.dotnet.framework.adonet)