When should I use Odbc, OleDb, SQLClient? What are the tradeoffs

I start with the SQLServer database. Therefore, it seems to me that I should use the namespace System.Data.SqlClient. But there is a chance that we can close our SqlServer database and switch to MySql or Oracle. For this reason, I come up with a set of standards on how our .Net applications will interact with the database in order to simplify the transition to another database system in the future, if we need it.

So here are the standards:

  • Use ORM if possible (e.g. NHibernate) (No LINQ, since it only supports SqlServer, but what about the Entity Structure and its support for Oracle and MySql?)
  • If ORM is redundant, then use parameterized SQL queries.
  • Use stored procedures only for long or complex operations that need to be performed on the database.

This brings me to my main question . What namespace should I use to encode my DAL?

It seems to me that the choice between System.Data.ODBCand System.Data.OleDB:

  • What are the tradeoffs?
  • Is one of them preferable to the other?
  • What do you think of the first three standards?
+5
source share
7 answers

System.Data.SqlClient

It only connects to SQL Server 2000 and later, but you will get optimal performance when connecting to these databases.

System.Data.OledbClient

Connects to SQL 6.5

OLEDBClient , ORACLE Access. SQL Server SQLClient.

. ORACLE Microsoft ORACLEClient.

System.Data.ODBCClient

, ODBC. (, MS Access 97.)

+1

SQL Server. , , , , - . -. . , , . ORM, LLBLGen, .

, , LINQ SQL Server. LINQ-to-SQL. LINQ - , LINQ-to-SQL, LINQ-to-Entities, LINQ-to-objects LLBLGen LINQ.

+2

, SQLClient Odbc, , , .

+2

SqlClient / DAL, .

, , - DAL, , DAL , .

+1

, ( ), ORM - . / DAL, . , , - , .

+1

, SQL Server SqlClient , OleDB ODBC - , , , DAL.

, OleDB/ODBC - - DAL, .

+1

, , , . ,

SQLClient will give you its own access and should be more perfect (it does not need to do abstractions / translations).

The only thing you need to change to get OLEDB to work against ODBC is your connection string. OLEDB has a bit more client-side information, so it offers better performance.

0
source

All Articles