SQLConnection vs. OLEDbConnection

Posted on 2009-04-21
Last Modified: 2012-08-13

Our system will allow users to add different OLEDB connections to connect to different databases. The user choose a provider and other parameters for that OLEDB.

Do you recommend that the program check what provider the user choose and make different connections?

For example, the user add an MSDAORA (oracle) then we make an OLEDbConnection and if the user choose SQLOLEDB we make a SQLConnection or doesn't it matter? Is it bad practice to use OLEDbConnection all the time? (much easier to code...)

I guess most of you will say , use SQLConnection if it's SQL Server, but what's the benefit to  make a SQLConnection instead of an OLEDBConnection with SQLOLEDB or SQLNCLI as the provider?

Question by:xlmaster200
    LVL 32

    Accepted Solution

    >> but what's the benefit to  make a SQLConnection instead of an OLEDBConnection with SQLOLEDB or SQLNCLI as the provider?

    Efficiency.  One less middle-man layer.

    Is that worth the additional complexity?  That depends on the efficiency requirements of the application.

    btw, there's an Oracle .Net provider that's more efficient that the OleDB one also.  If you're interested in top efficiency, you'll use the most appropriate provider each time, falling back to OleDB only when necessary.  The code does get more complex that way, however.

    Author Comment

    Hi, thanks for your answer.

    I'll try to follow your advice.


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now