ADO Connection Pooling Using CPP.

Discussion in 'C++' started by sk.rasheedfarhan@gmail.com, Dec 8, 2006.

  1. Guest

    Hi ,

    i want to manage connection pooling using C++ code, below is the code i
    am using so can any body tell me if this code is correct or not ? if
    not plz send me a snap shot !!!
    if the code is correct i am having some queries:
    1) my connection string is correct or not ? In my code it
    is not throwing any exception & working properly
    2) in connection string i am using pooling = true/false
    but it is not creating new connection. i hope it is using pooling
    concept implicitly but in false case it has to create a new conection
    each iteration.
    3) m_pConnection->Close(); is not loosing the connection
    i am seeing in the Perfmon.msc ->(SQL Server:General Statistics,User
    Connections) but it is not loosing the connection(graph is not
    falling).

    I was very confused to Debug and analyze according to theory concepts
    so plz some body help.


    int main()
    {
    CoInitialize(NULL);
    _ConnectionPtr m_pConnection;
    _ConnectionPtr rasheed;
    m_pConnection.CreateInstance(__uuidof(Connection));
    for(int i = 0; i < 100; i++)
    {
    try
    {
    //Connection String and Connection
    Creation........
    m_pConnection->Open("Provider='SQLOLEDB';
    Persist Security
    Info=False;UserID=sa;Password=sa;
    Data Source=(local);Initial
    Catalog='databasename';Integrated
    Security='SSPI';Min Pool
    Size=0;Max Pool Size=10;OLE DB Services= -
    1; pooling = true","","",
    adConnectUnspecified );

    //Connection Close........
    m_pConnection->Close();
    }//End of Try block

    catch(_com_error & conn)
    {

    printf("%s",conn.ErrorMessage);
    }//End of Catch block
    }//End of loop

    CoUninitialize();
    return 0;
    }

    Sincerly,
    Rasheed
     
    , Dec 8, 2006
    #1
    1. Advertising

  2. Howard Guest

    <> wrote in message
    news:...
    > Hi ,
    >
    > i want to manage connection pooling using C++ code, below is the code i
    > am using so can any body tell me if this code is correct or not ? if
    > not plz send me a snap shot !!!


    You'll need to ask in a newsgroup related to ADO, databases, or the like.
    There is nothing in the C++ language (which is what we discuss here) which
    directly supports database connections. You might try a Google search to
    see what groups have responded to ADO questions in the past.

    -Howard
     
    Howard, Dec 8, 2006
    #2
    1. Advertising

  3. Guest

    Thanks Howard,

    U saved my valuable time............by suggesting good group.....


    Howard wrote:
    > <> wrote in message
    > news:...
    > > Hi ,
    > >
    > > i want to manage connection pooling using C++ code, below is the code i
    > > am using so can any body tell me if this code is correct or not ? if
    > > not plz send me a snap shot !!!

    >
    > You'll need to ask in a newsgroup related to ADO, databases, or the like.
    > There is nothing in the C++ language (which is what we discuss here) which
    > directly supports database connections. You might try a Google search to
    > see what groups have responded to ADO questions in the past.
    >
    > -Howard
     
    , Dec 9, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Nicholson

    ADO.NET, connection pooling and ASP.NET

    Rob Nicholson, Aug 31, 2005, in forum: ASP .Net
    Replies:
    18
    Views:
    4,499
    Rob Nicholson
    Sep 17, 2005
  2. DrUg13
    Replies:
    1
    Views:
    487
    DrUg13
    Feb 10, 2004
  3. Alex Vinokur
    Replies:
    7
    Views:
    417
    Greg Comeau
    Nov 15, 2004
  4. Vinu
    Replies:
    9
    Views:
    645
  5. www.hitechskill.com
    Replies:
    0
    Views:
    1,372
    www.hitechskill.com
    Apr 9, 2006
Loading...

Share This Page