Open/Close Connection String 
Author Message
 Open/Close Connection String

Is it a good practice to open and close an ADO connection for each
select/Insert/Update statements? Or I should reuse the connection for every
select/Insert/Update statements?


Fri, 26 Mar 2004 09:38:42 GMT  
 Open/Close Connection String
Theres the start of an argument.  Check above in the post "About ADO
connection?"  29/09/2001.  You'll get people arguing both methods (1
connection vs. open them as you need them).  I think it depends on your
particular situation.  What you connection limits are for the database, how
many users, etc... but that's just my opinion.  Most apparently believe in
opening/closing as you need them.  But in my view that is way too slow if
you can keep one connection open for each active user and use it for all
your recordsets, why not (it's much faster)?  Anyhow check above for some
opinions that are most likely better informed than mine.  Hope that helps
Bill


Quote:
> Is it a good practice to open and close an ADO connection for each
> select/Insert/Update statements? Or I should reuse the connection for
every
> select/Insert/Update statements?



Fri, 26 Mar 2004 15:23:13 GMT  
 Open/Close Connection String
Thanks a lot Bill Got an idea.. by the way, the connection string I used is
declared as a Public variable in my Activex DLL's start up module.
Previously the set up for this connection was that of a Close/Open
situation. I noticed that the web server where the activex where hosted
always hangsup. I suspect it to the connection string (hope im correct).


Quote:
> Theres the start of an argument.  Check above in the post "About ADO
> connection?"  29/09/2001.  You'll get people arguing both methods (1
> connection vs. open them as you need them).  I think it depends on your
> particular situation.  What you connection limits are for the database,
how
> many users, etc... but that's just my opinion.  Most apparently believe in
> opening/closing as you need them.  But in my view that is way too slow if
> you can keep one connection open for each active user and use it for all
> your recordsets, why not (it's much faster)?  Anyhow check above for some
> opinions that are most likely better informed than mine.  Hope that helps
> Bill



> > Is it a good practice to open and close an ADO connection for each
> > select/Insert/Update statements? Or I should reuse the connection for
> every
> > select/Insert/Update statements?



Fri, 26 Mar 2004 13:34:21 GMT  
 Open/Close Connection String
If you connect using an ODBC connectionstring, the connections will be
pooled so there is no reason to keep it open. As soon as you open a "new"
connection, you will get one of the connections still in the pool.

For component development, this is the way to go. I can not remember ever
using a connection object in a component since i've always used a connection
string to open my recordsets directly.

HTH,
Evert

--
=======================================
My email address has been altered to
avoid unwanted email.

Replies to the newsgroup only, please.

Thanks,
Evert Timmer:
Transworld Software
VC++, VB6, SQL Server Database Solutions
http://www.transworld-software.com (under construction)
=======================================


Quote:
> Is it a good practice to open and close an ADO connection for each
> select/Insert/Update statements? Or I should reuse the connection for
every
> select/Insert/Update statements?



Tue, 06 Apr 2004 13:21:10 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Does ADO Connection.Close ,Closes all open Recordsets

2. SQL Server connections not closing when Access connection also open

3. Help how to close an open connection prior to compactdb

4. ADO Database connection open or closed?

5. Open and Close Internet connection from VB

6. Opening and Closing a DUN Connection

7. JET ODBC Cached Connections remains open after a Snapshot Close Method is used

8. Is a Connection Open or Closed

9. Opening and closing connections is slowing program...

10. When to open/close an ADO connection

11. Opening the connection string.

 

 
Powered by phpBB® Forum Software