BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TADOConnection question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
David Freeman
Guest





PostPosted: Sat May 12, 2007 8:11 am    Post subject: TADOConnection question Reply with quote



Using Delphi 7 Professional...

Currently I set myadoconnection.open at the start of my program and .close
at the end of the program. This means that the user has the connection open
all day. I have not had any problems with this and, at least with AS/400s,
this has a huge performance benefit.

However, I am now using SQL Server and read that this is not the best
option. I read that I should open the adoconnection before each select and
close it immediately after. (I assume that the open .. close should enclose
a transaction?)

My question: When using SQL Server 2005, should I have the
adoconnection.open only for the brief periods where it is needed?

Many thanks
David
Back to top
Del Murray
Guest





PostPosted: Sun May 13, 2007 1:53 am    Post subject: Re: TADOConnection question Reply with quote



It depends on the type of application but in general the answer is NO. Sql
server will manage all the open connections and roll out the inactive ones
if they are not used.

This is not true if you use multiple connections to SQL Server. If you use
ADO and you create 3 tADODataSets and put a connection string in each object
you will soon find yourself in connection hell. Use a tADOConnection, rout
all other data objects thru that connection , open it at startup, close it
at shutdown.

There are about as many opinions about this as there are programmers .. All
I can say is, this works great for me, others may have some better ideas
that I haven't learned about in the last 10 years.

Del
Back to top
David Freeman
Guest





PostPosted: Sun May 13, 2007 8:11 am    Post subject: Re: TADOConnection question Reply with quote



Thanks for your quick reply Del. Your comments match what I was thinking.

(as an aside, I am only using tadoquery and tadocommand for my i/o)

regards
David
Back to top
Del Murray
Guest





PostPosted: Mon May 14, 2007 4:11 am    Post subject: Re: TADOConnection question Reply with quote

try sticking to tadoDataSet .. tadoQuery was only for backward compatibility
to Delphi 3
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.