Re: Oledb* Or SQL* classes

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 04/16/04


Date: Fri, 16 Apr 2004 08:46:01 -0400

Dinko:

SqlClient is optimized for SqlServer. To say that OleDb is optimized for
all other databases though is a bit of a stretch. I'd recommend using a
factory pattern to build your logic with. You can easily branch it to
another provider with minimal changes but it's important to remember that
there are some pretty notable differences in Database implementations. If
you upgrade from Access to SQL Server, you'd have a little rework, but what
if you went to Oracle? If you used OleDb originally, you'd still be in a
situation where you were using a non-native provider or you'd have the
rework to do to migrate to a new provider.

A factory will allow you to specify what's what and create objects
accordingly, but taking advantage of any provider specific db is
antagonsitic to any truly 'generic' approach. Access doesn't use stored
procs the same way sql server does and it has different datatypes.

Which leads to another point. Even if you did use OleDb, you'd still
probably have to port your code to SqlServer or Oracle if you changed b/c
ISNULL is totally different in Access than it is in Oracle or T-Sql. Dates
are handled differently. There are many other subtleties that could effect
the occassion as well.

Changing back ends is something that probably won't happen but once, twice
at the most in any case I've worked with...and twice was a LOT.
So a pretty simple factory pattern could handle this for you, and then
when/if you migrate to SqlServer, you could get it ported then start taking
advantage of the procs, UDF's etc and migrate at a comfortable pace.

HTH,

Bill

These might also help.. http://abstractadonet.sourceforge.net/
http://www.dnzone.com/showDetail.asp?TypeId=2&NewsId=276
"Dinko Deranja" <dderanj1@public.srce.hr> wrote in message
news:e#13#p6IEHA.256@TK2MSFTNGP12.phx.gbl...
> I read that SQL* classes are optimized for working with SQL Server, and
> OleDB classes are for all other Ole DB providers.
>
> BUT, what if I now have an Access database and I wish to upgrade to SQL
> Server, or downgrade from SQL Server to Access. Does this mean that I
would
> have to replace all OLEDB* with SQL* classes or vice versa? Isn't it
better
> to work with OleDB Classes and later only change the connection string in
> case of upgrade?
>
>



Relevant Pages

  • Re: Using Multiple Datasources
    ... If you have the same interface, then you've done most of the work. ... Understanding the Simple Factory Pattern ... provider, the other is specific to SQL Server using the SQLServer ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: OleDb DataFactory bug. Watch out.
    ... OLEDB is a ton more finicky than the SQL Server ... recordset results would hang on NextRecordsetwhen you got to the ... Using the OleDb factory. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: need help with connect string
    ... The mydb.mdf is not in the usual Sql server data folder. ... I realy don't know how to use OLEDB nor SQL Client in .net. ... I changed the provider to SQLNCLI. ...
    (microsoft.public.data.oledb)
  • Re: nVarchar limitations using OLEDB provider
    ... but not nvarcharor greater using a clientside cursor. ... is IMHO what OLEDB is designed for: ... Unless of course this OLEDB provider is not supported at all..... ... The issue may actually lie on the client code and not on the ...
    (microsoft.public.sqlserver.ce)
  • Re: Cannot display ODBC login prompt - want to connect without DSN
    ... ODBC was superseded thirteen years ago by OleDb: ... In this particular case, my program will conect to an Oracle database, but ... There does not seem to be a .NET provider for MS Access, ...
    (microsoft.public.dotnet.framework.adonet)

Loading