ADO.NET - ASP.NET (MCQ) questions and answers for Q. 8677

Q.  How do I explicitly turn on connection pooling for an OLE DB data source?
- Published on 19 Oct 15

a. By setting the OLE DB Services connection string keyword to 0
b. By setting the OLE DB Services connection string keyword to -4
c. By setting the OLE DB Services connection string keyword to -1
d. By setting the OLE DB Services connection string keyword to -7

ANSWER: By setting the OLE DB Services connection string keyword to -1
 

    Discussion

  • Raj   -Posted on 19 Oct 15
    Setting the OLE DB Services connection string keyword to -1 turns on all services, including pooling.

    Connection pooling is a technique that allows you to reuse existing connections. By using connection pooling there is no need to create and dispose of connections again and that have the same configuration.

    OleDbConnection object automatically pools connections by using the OLE DB session pooling. You can control how OLE DB connections use pooling by adding an OLE DB Services keyword to the connection string.

    Example:

    OLE DB connection string for an Office Access database.

    Let us assumes the Test.mdb file exists in the following path:

    D:\DataSources\Test.mdb.

    String conString=”Provider= Microsoft.Jet.OLEDB.4.0;Data Source=D:\DataSources\Test.mdb;OLE DB Services= -1”;

    OLE DB Connection String Settings for OLE DB Services

    OLE DB SERVICE ------------------------------- KEYWORD

    • All services on.----------------------------------- OLE DB Services = -1;
    • No services ---------------------------------------- OLE DB Services = 0;
    • All services except Pooling and --------- OLE DB Services = -4;
    AutoEnlistment of transactions.
    • All services except Client Cursor --------- OLE DB Services = -5;
    • All services except Pooling, ----------------- OLE DB Services = -8;
    AutoEnlistment, and Client Cursor.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)