OdbcConnections - more or less?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 200dogz
    New Member
    • Oct 2008
    • 52

    OdbcConnections - more or less?

    Performance speaking, is it better to stick with one connection or use a different one for each task?

    In my case I have something like:


    Code:
     
    string query = ...
    OdbcDataReader reader = [B]connectionA[/B] -> read query
     
    while (reader.Read())
    {
        ...
     
        query = ...
        OdbcDataReader reader2 = [B]connectionB[/B] -> read query
     
        if (reader.Read())
        {
            ...
        }
    }
    Should I use the same connection for A and B or different, or should I create a new connection for B for each loop?

    Thanks :) ,



    Billy
  • liawcv
    New Member
    • Jan 2009
    • 33

    #2
    Connect to database?

    For me, I will use a single Connection object, for database connection may be limited. And I will join 2 tables as a view (provided logically possible), so I can use just one DataReader to get the job done.

    Comment

    • 200dogz
      New Member
      • Oct 2008
      • 52

      #3
      Thanks for the suggestion :)

      Comment

      • vinot85
        New Member
        • Aug 2007
        • 53

        #4
        Limiting the connections to a database is always advisable. Because it increases the performance of the application thereby decreasing the database server load.

        Comment

        Working...