Results 1 to 2 of 2

Thread: Query.............

  1. #1
    Join Date
    Dec 1969

    Default Query.............

    In my ASP page in am calling four methods COM Components when the page is being loaded<BR>Which of these is a better option..<BR>case1 Should i use a global connection and then use this connection for calling these four components instead of creating a connection inside these four components<BR>or<BR>case2 should i pass the connection string to all these components and then create a connection individually for all these components and destroy the connection after the record is fetched..<BR><BR>Does the database take care of connection pooling in the second case...<BR>As for the first case is there any problem if i hold the connection for a long time..if many users access my site at a time<BR><BR><BR>please suggest..thanks and have a nice time...<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Query.............

    let me suggest a third options if i may. i will assume you are using ADO 2.6 and SQL Server. if you have 4 COM objects each accessing the database thru ADO, i would create a database object to handle your interface with the database and have the other 4 COM objects reference and call the database object. the benefits are many- you centralize your database object, so that if there are any database changes (connection string, username, password, database name, etc..) all your changes are in one place. Also, if you want to leverage connection pooling with ADO, the connection strings have to be identical. Meaning that if by accident a developer adds a space in the connection string, ADO will create another connection pool instead of leveraging a pre-existing connection. Essentally, take that power out of many and centralize if in one place. why have other developers worry about database connection/ADO details? create a database object that hides all the gory details of connecting to and retrieving data from a database. have the interface easy enough that a new developer who didn&#039;t know a lick about databases could use your database object with no problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts